Point#

Point represents a point in the plane, defined by its x and y coordinates.

Attribute / Method

Description

Point.DistanceTo()

Calculate distance to point or rect

Point.Transform()

Transform point with a matrix

Point.Abs

Same as unit, but positive coordinates

Point.Unit

Point coordinates divided by abs(point)

Point.X

The X-coordinate

Point.Y

The Y-coordinate

Class API

class Point#
Point()#
Point(float x, float y)#
Point(Point point)#
Point(FzPoint point)#

Overloaded constructors.

Without parameters, Point(0, 0) will be created.

With another point or FzPoint specified, a new copy will be created.

Parameters:
  • x (float) – x coordinate of the point

  • y (float) – y coordinate of the point

DistanceTo(Point x, string unit)#
DistanceTo(Rect x, string unit)#

Calculate the distance to x, which may be Point or Rect. The distance is given in units of either pixels (default), inches, centimeters or millimeters.

Parameters:
  • x (Point, Rect) – to which to compute the distance.

  • unit (string) – the unit to be measured in. One of “px”, “in”, “cm”, “mm”.

Return type:

float

Returns:

the distance to x. If this is Rect, then the distance

  • is the length of the shortest line connecting to one of the rectangle sides

  • is calculated to the finite version of it

  • is zero if it contains the point

Transform(m)#

Apply a matrix to the point and replace it with the result.

Parameters:

m (matrix_like) – The matrix to be applied.

Return type:

Point

Unit#

Result of dividing each coordinate by norm(point), the distance of the point to (0,0). This is a vector of length 1 pointing in the same direction as the point does. Its x, resp. y values are equal to the cosine, resp. sine of the angle this vector (and the point itself) has with the x axis.

../_images/img-point-unit.jpg
Type:

Point

Abs#

Same as unit above, replacing the coordinates with their absolute values.

Type:

Point

X#

The x coordinate

Type:

float

Y#

The y coordinate

Type:

float