Point2d

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

Constructors

Point2d

#Since v5.0
public Point2d(double x, double y)
Initializes a new instance of Point2d from coordinates.
x (double)The X (first) coordinate.
y (double)The Y (second) coordinate.

Point2d

#Since v5.0
public Point2d(Point2d point)
Initializes a new instance of Point2d by copying another Point2d.
point (Point2d)The point that will be copied.

Point2d

#Since v5.0
public Point2d(Point3d point)
Initializes a new instance of Point3d by copying the first two coordinates of a Point3d.
point (Point3d)The point that will be used: the Z (third) coordinate is discarded.

Point2d

#Since v5.0
public Point2d(Vector2d vector)
Initializes a new instance of Point2d by converting a vector.
vector (Vector2d)The vector that will be copied.

Properties

IsValid

#Since v5.0
public bool IsValid { get; }
If any coordinate of a point is UnsetValue, then the point is not valid.

MaximumCoordinate

#Since v5.0
public double MaximumCoordinate { get; }
Gets the largest valid coordinate, or RhinoMath.UnsetValue if no coordinate is valid.

MinimumCoordinate

#Since v5.0
public double MinimumCoordinate { get; }
Gets the smallest (both positive and negative) valid coordinate, or RhinoMath.UnsetValue if no coordinate is valid.

Origin

#Since v5.0
public static Point2d Origin { get; }
Gets a point at 0,0.

Unset

#Since v5.0
public static Point2d Unset { get; }
Gets a point at RhinoMath.UnsetValue,RhinoMath.UnsetValue.

X

#Since v5.0
public double X { get; set; }
Gets or sets the X (first) coordinate of the point.

Y

#Since v5.0
public double Y { get; set; }
Gets or sets the Y (second) coordinate of the point.

Indexers

this[]

#
public double this[int index] { get; set; }
Accesses the coordinates of this point.
index (int)Either 0 or 1.
If index is 0, the X (first) coordinate. If index is 1, the Y (second) coordinate.

Methods

Add

#Since v5.0
public static Point2d Add(Point2d point, Vector2d vector)
Adds a point with a vector.

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

point (Point2d)A point.
vector (Vector2d)A vector.
A new point that is coordinate-wise summed with the vector.

Add

#Since v5.0
public static Point2d Add(Point2d point1, Point2d point2)
Adds a point with a point.

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

point1 (Point2d)A point.
point2 (Point2d)A point.
A new point that is coordinate-wise summed with the other point.

Add

#Since v5.0
public static Point2d Add(Vector2d vector, Point2d point)
Adds a vector with a point.

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

vector (Vector2d)A vector.
point (Point2d)A point.
A new point that is coordinate-wise summed with the vector.

CompareTo

#Since v5.0
[ConstOperation] public int CompareTo(Point2d other)
Compares this Point2d with another Point2d.

Coordinates evaluation priority is first X, then Y.

other (Point2d)The other Point2d to use in comparison.

0: 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.

DistanceTo

#ExampleSince v5.0
[ConstOperation] public double DistanceTo(Point2d other)
Computes the distance between two points.
other (Point2d)Another point.
The length of the line between the two points, or 0 if either point is invalid.

DistanceToSquared

#Since v8.4
[ConstOperation] public double DistanceToSquared(Point2d other)
Computes the square of the distance between two 2d points.

This method is usually largely faster than DistanceTo().

other (Point2d)Other point for squared distance measurement.
The squared length of the line between this and the other point; or 0 if any of the points is not valid.

Divide

#Since v5.0
public static Point2d Divide(Point2d point, double t)
Divides a Point2d by a number.

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

point (Point2d)A point.
t (double)A number.
A new point that is coordinate-wise divided by t.

EpsilonEquals

#Since v5.4
[ConstOperation] public bool EpsilonEquals(Point2d other, double epsilon)
Check that all values in other are within epsilon of the values in this
other (Point2d)
epsilon (double)
EpsilonEquals

Equals

#
[ConstOperation] public override bool Equals(object obj)
Determines whether the specified System.Object is a Point2d and has the same values as the present point.
obj (object)The specified object.
true if obj is a Point2d and has the same coordinates as this; otherwise false.
ValueType.Equals

Equals

#Since v5.0
[ConstOperation] public bool Equals(Point2d point)
Determines whether the specified Point2d has the same values as the present point.
point (Point2d)The specified point.
true if point has the same coordinates as this; otherwise false.

GetHashCode

#
[ConstOperation] public override int GetHashCode()
Computes a hash number that represents the current point.
A hash code that is not unique for each point.

Multiply

#Since v5.0
public static Point2d Multiply(double t, Point2d point)
Multiplies a Point2d by a number.

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

t (double)A number.
point (Point2d)A point.
A new point that is coordinate-wise multiplied by t.

Multiply

#Since v5.0
public static Point2d Multiply(Point2d point, double t)
Multiplies a Point2d by a number.

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

point (Point2d)A point.
t (double)A number.
A new point that is coordinate-wise multiplied by t.

Subtract

#Since v5.0
public static Point2d Subtract(Point2d point, Vector2d vector)
Subtracts a vector from a point.

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

point (Point2d)A point.
vector (Vector2d)A vector.
A new point that is coordinate-wise subtracted by vector.

Subtract

#Since v5.0
public static Vector2d Subtract(Point2d point1, Point2d point2)
Subtracts the second point from the first point.

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

point1 (Point2d)A point (minuend).
point2 (Point2d)A point (subtrahend).
A new vector that is point1 coordinate-wise subtracted by point2.
Explicit

IComparable.CompareTo

#
[ConstOperation] int IComparable.CompareTo(object obj)
obj (object)
Explicit

ISerializable.GetObjectData

#
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
info (SerializationInfo)
context (StreamingContext)

ToString

#
[ConstOperation] public override string ToString()
Constructs the string representation for the current point.
The point representation in the form X,Y.

ToString

#Since v7.0
[ConstOperation] public string ToString(string format, IFormatProvider formatProvider)
Formats the value of the current instance using the specified format.
format (string)The format to use. -or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.
formatProvider (IFormatProvider)The provider to use to format the value. -or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
The value of the current instance in the specified format.

Transform

#Since v5.1
public void Transform(Transform xform)
Transforms the present point in place. The transformation matrix acts on the left of the point. i.e.,

result = transformation*point

xform (Transform)Transformation to apply.

Operators

OperationResultDescription
Point2d+Vector2dPoint2dAdds a point with a vector.
Point2d+Point2dPoint2dAdds a point with a point.
Vector2d+Point2dPoint2dAdds a vector with a point.
Point2d/doublePoint2dDivides a Point2d by a number.
Point2d==Point2dboolDetermines whether two Point2d have equal values.
Point2d>Point2dboolDetermines whether the first specified Point2d comes after (has superior sorting value than) the second point.

Coordinates evaluation priority is first X, then Y.

Point2d>=Point2dboolDetermines whether the first specified Point2d comes after (has superior sorting value than) the second point, or it is equal to it.

Coordinates evaluation priority is first X, then Y.

Point2d!=Point2dboolDetermines whether two Point2d have different values.
Point2d<Point2dboolDetermines whether the first specified point comes before (has inferior sorting value than) the second point.

Coordinates evaluation priority is first X, then Y.

Point2d<=Point2dboolDetermines whether the first specified point comes before (has inferior sorting value than) the second point, or it is equal to it.

Coordinates evaluation priority is first X, then Y.

double*Point2dPoint2dMultiplies a Point2d by a number.
Point2d*doublePoint2dMultiplies a Point2d by a number.
Point2d-Vector2dPoint2dSubtracts a vector from a point.
Point2d-Point2dVector2dSubtracts point2 from point1.