Point2f

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

Constructors

Point2f

#Since v5.0
public Point2f(double x, double y)
Initializes a new two-dimensional point from two double-precision floating point numbers as coordinates.

Coordinates will be internally converted to floating point numbers. This might cause precision loss.

x (double)X component of vector.
y (double)Y component of vector.

Point2f

#Since v5.0
public Point2f(float x, float y)
Initializes a new two-dimensional point from two components.
x (float)X component of vector.
y (float)Y component of vector.

Properties

IsValid

#Since v5.0
public bool IsValid { get; }
Gets a value indicating whether this point is considered valid.

Unset

#Since v5.0
public static Point2f Unset { get; }
Gets the standard unset point.

X

#Since v5.0
public float X { get; set; }
Gets or sets the X (first) component of the vector.

Y

#Since v5.0
public float Y { get; set; }
Gets or sets the Y (second) component of the vector.

Indexers

this[]

#
public float 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

CompareTo

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

Coordinates evaluation priority is first X, then Y.

other (Point2f)The other Point2f 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

#
[ConstOperation] public double DistanceTo(Point2f other)
Computes the distance between two points.
other (Point2f)Other point for distance measurement.
The length of the line between this and the other point; or 0 if any of the points is not valid.

DistanceToSquared

#Since v7.14
[ConstOperation] public double DistanceToSquared(Point2f other)
Computes the squared distance between two points.
other (Point2f)Other point for distance measurement.
The squared length of the line between this and the other point; or 0 if any of the points is not valid.

EpsilonEquals

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

Equals

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

Equals

#Since v5.0
[ConstOperation] public bool Equals(Point2f point)
Determines whether the specified Point2f has the same values as the present point.
point (Point2f)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.
Explicit

IComparable.CompareTo

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

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.

Operators

OperationResultDescription
Point2f+Point2fVector2fSums two Point2fs.
Point2f/floatPoint2fDivides a Point2f by a scalar.
Point2f==Point2fboolDetermines whether two Point2f have equal values.
Point2f>Point2fboolDetermines whether the first specified Point2f comes after (has superior sorting value than) the second point.

Coordinates evaluation priority is first X, then Y.

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

Coordinates evaluation priority is first X, then Y.

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

Coordinates evaluation priority is first X, then Y.

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

Coordinates evaluation priority is first X, then Y.

Point2f*floatPoint2fMultiplies a Point2f by a scalar.
Point2f-Point2fVector2fSubtracts two Point2fs.

Convertors

OperationResultDescription
explicitPoint2dPoint2fConverts a double-precision point in a single-precision point. Needs explicit casting to help retain precision.