rhino3dm.Point2d

class rhino3dm.Point2d
class Point2d(x: float, y: float)
class Point2d(vector: Vector2d)
class Point2d(arg: Point2d)
class Point2d(point: Point3d)
class Point2d(arg: collections.abc.Sequence[Any], /)

Represents the two coordinates of a point in two-dimensional space, using double-precision floating point numbers.

static Add(point: Point2d, vector: Vector2d) → Point2d
static Add(vector: Vector2d, point: Point2d) → Point2d
static Add(point1: Point2d, point2: Point2d) → Point2d

Adds a point with a point.

(Provided for languages that do not support operator overloading. You can use the + operator otherwise)

Parameters:
  • point1 – A point.

  • point2 – A point.

Returns:

A new point that is coordinate-wise summed with the other point.

CompareTo(other: Point2d) → int

Compares this Point2d with another Point2d.

Coordinates evaluation priority is first X, then Y.

Parameters:

other – The other Point2d to use in comparison.

Returns:

if this is identical to other -1: if this.X < other.X -1: if this.X == other.X and this.Y < other.Y +1: otherwise.

Return type:

0

DistanceTo(other: Point2d) → float

Computes the distance between two points.

Parameters:

other – Another point.

Returns:

The length of the line between the two points, or 0 if either point is invalid.

DistanceToSquared(other: Point2d) → float

Computes the square of the distance between two 2d points.

This method is usually largely faster than DistanceTo().

Parameters:

other – Other point for squared distance measurement.

Returns:

The squared length of the line between this and the other point; or 0 if any of the points is not valid.

static Divide(point: Point2d, t: float) → Point2d

Divides a Point2d by a number.

(Provided for languages that do not support operator overloading. You can use the / operator otherwise)

Parameters:
  • point – A point.

  • t – A number.

Returns:

A new point that is coordinate-wise divided by t.

Encode() → dict[str, Any]

This object as a JSON-compatible dict (rhino3dm only; inverse: Decode).

Returns:

geometry and other objects are stored as their 3dm archive, base64 encoded, with the archive version.

Return type:

A dict of numbers and strings

EpsilonEquals(other: Point2d, epsilon: float) → bool

Check that all values in other are within epsilon of the values in this

Equals(point: Point2d) → bool

Determines whether the specified Point2d has the same values as the present point.

Parameters:

point – The specified point.

Returns:

true if point has the same coordinates as this; otherwise false.

static Multiply(point: Point2d, t: float) → Point2d
static Multiply(t: float, point: Point2d) → Point2d

Multiplies a Point2d by a number.

(Provided for languages that do not support operator overloading. You can use the * operator otherwise)

Parameters:
  • t – A number.

  • point – A point.

Returns:

A new point that is coordinate-wise multiplied by t.

static Negate(point: Point2d) → Point2d

Computes the additive inverse of all coordinates in the point, and returns the new point.

(Provided for languages that do not support operator overloading. You can use the - unary operator otherwise)

Parameters:

point – A point.

Returns:

A point value that, when summed with the point input, yields the Origin.

static Subtract(point: Point2d, vector: Vector2d) → Point2d
static Subtract(point1: Point2d, point2: Point2d) → Vector2d

Subtracts the second point from the first point.

(Provided for languages that do not support operator overloading. You can use the - operator otherwise)

Parameters:
  • point1 – A point (minuend).

  • point2 – A point (subtrahend).

Returns:

A new vector that is point1 coordinate-wise subtracted by point2.

ToString() → str

Constructs the string representation for the current point.

Returns:

The point representation in the form X,Y.

Transform(xform: Transform) → None

Transforms the present point in place. The transformation matrix acts on the left of the point. i.e.,

result = transformation*point

Parameters:

xform – Transformation to apply.

property IsValid: bool

If any coordinate of a point is UnsetValue, then the point is not valid.

property MaximumCoordinate: float

Gets the largest valid coordinate, or RhinoMath.UnsetValue if no coordinate is valid.

property MinimumCoordinate: float

Gets the smallest (both positive and negative) valid coordinate, or RhinoMath.UnsetValue if no coordinate is valid.

Origin: Point2d = Ellipsis

object, /) -> Point2d

Type:

(arg

Unset: Point2d = Ellipsis

object, /) -> Point2d

Type:

(arg

property X: float

Gets or sets the X (first) coordinate of the point.

property Y: float

Gets or sets the Y (second) coordinate of the point.