Point2d

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

Constructors

Point2d

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

Point2d

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

Point2d

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

Point2d

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

Properties

IsValid

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

MaximumCoordinate

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

MinimumCoordinate

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

Origin

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

Unset

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

X

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

Y

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

Indexers

this[]

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

Methods

Add

#Since v5.0
Adds a point with a vector.

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

public static Point2d Add(
point,
A point.
vector
A vector.
)
A new point that is coordinate-wise summed with the vector.

Add

#Since v5.0
Adds a point with a point.

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

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

Add

#Since v5.0
Adds a vector with a point.

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

public static Point2d Add(
vector,
A vector.
point
A point.
)
A new point that is coordinate-wise summed with the vector.

CompareTo

#Since v5.0
Compares this Point2d with another Point2d.

Coordinates evaluation priority is first X, then Y.

[ConstOperation] public int CompareTo(
other
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
Computes the distance between two points.
[ConstOperation] public double DistanceTo(
other
Another point.
)
The length of the line between the two points, or 0 if either point is invalid.

DistanceToSquared

#Since v8.4
Computes the square of the distance between two 2d points.

This method is usually largely faster than DistanceTo().

[ConstOperation] public double DistanceToSquared(
other
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
Divides a Point2d by a number.

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

public static Point2d Divide(
point,
A point.
t
A number.
)
A new point that is coordinate-wise divided by t.

EpsilonEquals

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

Equals

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

Equals

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

GetHashCode

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

Multiply

#Since v5.0
Multiplies a Point2d by a number.

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

public static Point2d Multiply(
t,
A number.
point
A point.
)
A new point that is coordinate-wise multiplied by t.

Multiply

#Since v5.0
Multiplies a Point2d by a number.

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

public static Point2d Multiply(
point,
A point.
t
A number.
)
A new point that is coordinate-wise multiplied by t.

Negate

#
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)

public static Point2d Negate(
point
A point.
)
A point value that, when summed with the point input, yields the Origin.

Subtract

#Since v5.0
Subtracts a vector from a point.

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

public static Point2d Subtract(
point,
A point.
vector
A vector.
)
A new point that is coordinate-wise subtracted by vector.

Subtract

#Since v5.0
Subtracts the second point from the first point.

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

public static Vector2d Subtract(
point1,
A point (minuend).
point2
A point (subtrahend).
)
A new vector that is point1 coordinate-wise subtracted by point2.
Explicit

IComparable.CompareTo

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

ISerializable.GetObjectData

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

ToString

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

ToString

#Since v7.0
Formats the value of the current instance using the specified format.
[ConstOperation] public string ToString(
format,
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
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
Transforms the present point in place. The transformation matrix acts on the left of the point. i.e.,

result = transformation*point

public void Transform(
Transform
xform
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.
-Point2dPoint2dComputes the additive inverse of all coordinates in the point, and returns the new point.