# Point

Represents a point/vector in 2D or 3D

Point.add(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `Point`

  Add the corresponding components of points.

Point.addConstant(pointIn, constant)
  Arguments:

    - pointIn (`Point`)

    - constant (`float`)

  Return type:

    `Point`

  Add a constant to each component.

Point.arrangeOnGrid(points, purgeThreshold, distanceThreshold)
  Arguments:

    - points (`Point`)

    - purgeThreshold (`int`)

    - distanceThreshold (`float`)

  Return type:

    `int`

  Sort 2D points on a grid. This task is related to checkerboard arrangement, but can be used together with other features than checkerboard corners. The only requirement for all points in the output index vector is that the points they reference are nodes in a common grid. The gx and gy indices are roughly aligned to the x- and y-axes. In case of severe distortion and/or a rotated grid it may be difficult to align both x and y axes over the whole image. In this case an attempt is made to align gx to the x-axis. This function adapts to non-linear drift over the grid of points and can be used to arrange extracted features non-calibration corrected images. For checkerboard detection, see the dedicated function Image.Calibration.Pattern.detectCheckerboard, which also includes corner extraction. The purgeThreshold input can be used to remove isolated points along the border of the found grid. If a grid is required to have at least 4 points along each side we can set this threshold to 4 and only keep the central part of the grid that fulfills this requirement. This effectively shrinks the detected grid.

Point.clone(point)
  Argument:

    - point (`Point`)

  Return type:

    `Point`

  Create an independent copy of this point. If the input is a vector of points, the output is a vector of points.

Point.create(x, y, z)
  Arguments:

    - x (`float`)

    - y (`float`)

    - z (`float`)

  Return type:

    `Point`

  Create 2D or 3D point(s). The third z-coordinate input is optional, if omitted a 2D point is created, otherwise a 3D point. Vector input is allowed to create vectors of points. The input vectors must then all be of equal length.

  The following input combinations are allowed: Two scalar floats give a 2D point (x,y) Three scalar floats give a 3D point (x,y,z) Two vectors of equal length give a vector of 2D points Three vectors of equal length give a vector of 3D points

Point.cross(a, b)
  Arguments:

    - a (`Point`)

    - b (`Point`)

  Return type:

    `Point`

  Calculates the cross product of two point vectors (only 3D). The cross product is anti-commutative: a x b = -(b x a)

Point.divide(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `Point`

  Divide the components of the first point with the corresponding components of the second point.

Point.divideConstant(pointIn, constant)
  Arguments:

    - pointIn (`Point`)

    - constant (`float`)

  Return type:

    `Point`

  Divide each component with a constant.

Point.dot(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `float`

  Calculates the dot product of two point vectors of the same dimensionality (e.g. x1*x2+y1*y2+z1*z2).

Point.getDistance(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `float`

  Compute the distance between the two points of the same dimensionality (2D or 3D).

Point.getDistanceToLine(pointIn, line)
  Arguments:

    - pointIn (`Point`)

    - line (`const auto`)

  Return type:

    `float`

  Calculates the distance from a point to a line (2D/3D).

Point.getDistanceToPlane(pointIn, plane)
  Arguments:

    - pointIn (`Point`)

    - plane (`Shape3D`)

  Return type:

    `float`

  Calculates the distance from a point to a plane (only 3D).

Point.getX(point)
  Argument:

    - point (`Point`)

  Return type:

    `float`

  Get the X coordinate of a point.

Point.getXY(point)
  Argument:

    - point (`Point`)

  Return type:

    `float`

  Get the X and Y coordinates of a point.

Point.getXYZ(point)
  Argument:

    - point (`Point`)

  Return type:

    `float`

  Get the X, Y and Z coordinates of a point (only 3D).

Point.getY(point)
  Argument:

    - point (`Point`)

  Return type:

    `float`

  Get the Y coordinate of a point.

Point.getZ(point)
  Argument:

    - point (`Point`)

  Return type:

    `float`

  Get the Z coordinate of a point.

Point.is2D(point)
  Argument:

    - point (`Point`)

  Return type:

    `boolean`

  Check if a point is a 2D point.

Point.is3D(point)
  Argument:

    - point (`Point`)

  Return type:

    `boolean`

  Check if a point is a 3D point.

Point.isFinite(point)
  Argument:

    - point (`Point`)

  Return type:

    `boolean`

  Check if a point is finite, i.e. none of the values is Inf/NaN.

Point.isZero(point)
  Argument:

    - point (`Point`)

  Return type:

    `boolean`

  Returns true if all coordinates are zero.

Point.mean(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `Point`

  Calculate the mean position of the points. Can either be used for finding the midpoint of two Points or for finding the mean position of many points.

Point.multiply(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `Point`

  Multiply the corresponding components of two points.

Point.multiplyConstant(pointIn, constant)
  Arguments:

    - pointIn (`Point`)

    - constant (`float`)

  Return type:

    `Point`

  Multiply each component with a constant.

Point.negate(pointIn)
  Argument:

    - pointIn (`Point`)

  Return type:

    `Point`

  Returns the negated point vector (every component changes its sign).

Point.norm(pointIn, type)
  Arguments:

    - pointIn (`Point`)

    - type (`enum`)

  Return type:

    `float`

  Calculates different types of non-negative vector norms. If no enumeration is provided, the “L-2-Norm” will be calculated, which represents the magnitude or length of the point vector.

Point.normalize(pointIn)
  Argument:

    - pointIn (`Point`)

  Return type:

    `Point`

  Returns the unit vector (length=1) with the same direction or nil if the input point vector has the length 0.

Point.projectOntoPlane(pointIn, plane)
  Arguments:

    - pointIn (`Point`)

    - plane (`Shape3D`)

  Return type:

    `Point`

  Projects one or multiple points onto a plane (only 3D).

Point.setX(point, x)
  Arguments:

    - point (`Point`)

    - x (`float`)

  Set the X coordinate of a point.

Point.setXY(point, x, y)
  Arguments:

    - point (`Point`)

    - x (`float`)

    - y (`float`)

  Set the X and Y coordinates of a point.

Point.setXYZ(point, x, y, z)
  Arguments:

    - point (`Point`)

    - x (`float`)

    - y (`float`)

    - z (`float`)

  Set the X, Y and Z coordinates of a point (only 3D).

Point.setY(point, y)
  Arguments:

    - point (`Point`)

    - y (`float`)

  Set the Y coordinate of a point.

Point.setZ(point, z)
  Arguments:

    - point (`Point`)

    - z (`float`)

  Set the Z coordinate of a point.

Point.subtract(point1, point2)
  Arguments:

    - point1 (`Point`)

    - point2 (`Point`)

  Return type:

    `Point`

  Subtract the corresponding components of the second point from those of the first point.

Point.subtractConstant(pointIn, constant)
  Arguments:

    - pointIn (`Point`)

    - constant (`float`)

  Return type:

    `Point`

  Subtract a constant from each component.

Point.toMatrix(point, storeInColumns)
  Arguments:

    - point (`Point`)

    - storeInColumns (`boolean`)

  Return type:

    `Matrix`

  Converts a point or a vector of points to a matrix.

Point.toString(point)
  Argument:

    - point (`Point`)

  Return type:

    `string`

  Get a string representation of the point.

Point.transform(point, transform)
  Arguments:

    - point (`Point`)

    - transform (`Transform`)

  Return type:

    `Point`

  Transforms point or a vector of points. For 2D points a 2D transform must be supplied, for 3D points a 3D transform.