Struct Point
public struct Point
- Inherited Members
Constructors
Point(NFloat, NFloat)
Initializes a new point with the specified coordinates.
public Point(NFloat x, NFloat y)
Parameters
Fields
One
A point at (1, 1), useful for normalized coordinates or vector math.
public static readonly Point One
Field Value
X
The X-coordinate of the point.
public NFloat X
Field Value
Y
The Y-coordinate of the point.
public NFloat Y
Field Value
Zero
A point at the origin (0, 0).
public static readonly Point Zero
Field Value
Methods
Distance(Point, Point)
Returns the Euclidean distance between two points.
public static NFloat Distance(Point a, Point b)
Parameters
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Equals(Point)
Returns true if this point has the same coordinates as another.
public bool Equals(Point other)
Parameters
other
Point
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Lerp(Point, Point, NFloat)
Linearly interpolates between two points by step
.
public static Point Lerp(Point start, Point end, NFloat step)
Parameters
start
PointThe start point.
end
PointThe end point.
step
NFloatA value from 0 to 1 indicating the interpolation position.
Returns
SquaredDistance(Point, Point)
Returns the squared Euclidean distance between two points (no square root). Useful for performance comparisons or ordering by proximity.
public static NFloat SquaredDistance(Point a, Point b)
Parameters
Returns
TaxicabDistance(Point, Point)
Returns the Manhattan (taxicab) distance between two points.
public static NFloat TaxicabDistance(Point a, Point b)
Parameters
Returns
Remarks
The sum of the absolute horizontal and vertical distances. Often used in grid-based or discrete movement systems.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator +(Point, Vector)
Offsets a point by a vector.
public static Point operator +(Point lhs, Vector rhs)
Parameters
Returns
operator ==(Point, Point)
Determines whether two points have equal coordinates.
public static bool operator ==(Point lhs, Point rhs)
Parameters
Returns
explicit operator Point(Vector)
Explicitly converts a vector to a point (drops directional semantics).
public static explicit operator Point(Vector vector)
Parameters
vector
Vector
Returns
implicit operator Point((NFloat, NFloat))
Converts a tuple to a point.
public static implicit operator Point((NFloat, NFloat) tuple)
Parameters
tuple
(NFloat horizontal, NFloat vertical)
Returns
operator !=(Point, Point)
Determines whether two points differ in any coordinate.
public static bool operator !=(Point lhs, Point rhs)
Parameters
Returns
operator *(Point, NFloat)
Apply an uniform scale to a point.
public static Point operator *(Point v, NFloat f)
Parameters
Returns
operator -(Point, Point)
Returns the vector difference from one point to another.
public static Vector operator -(Point lhs, Point rhs)
Parameters
Returns
operator -(Point, Vector)
Subtracts a vector from a point, offsetting it in the opposite direction.
public static Point operator -(Point lhs, Vector rhs)