Table of Contents

Struct Point

Namespace
Xui.Core.Math2D
Assembly
Core.dll

Represents a point in 2D space, defined by its X and Y coordinates.

public struct Point
Inherited Members

Constructors

Point(NFloat, NFloat)

Initializes a new point with the specified coordinates.

public Point(NFloat x, NFloat y)

Parameters

x NFloat
y NFloat

Fields

One

A point at (1, 1), useful for normalized coordinates or vector math.

public static readonly Point One

Field Value

Point

X

The X-coordinate of the point.

public NFloat X

Field Value

NFloat

Y

The Y-coordinate of the point.

public NFloat Y

Field Value

NFloat

Zero

A point at the origin (0, 0).

public static readonly Point Zero

Field Value

Point

Methods

Distance(Point, Point)

Returns the Euclidean distance between two points.

public static NFloat Distance(Point a, Point b)

Parameters

a Point
b Point

Returns

NFloat

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The 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

bool

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 Point

The start point.

end Point

The end point.

step NFloat

A value from 0 to 1 indicating the interpolation position.

Returns

Point

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

a Point
b Point

Returns

NFloat

TaxicabDistance(Point, Point)

Returns the Manhattan (taxicab) distance between two points.

public static NFloat TaxicabDistance(Point a, Point b)

Parameters

a Point
b Point

Returns

NFloat

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

lhs Point
rhs Vector

Returns

Point

operator ==(Point, Point)

Determines whether two points have equal coordinates.

public static bool operator ==(Point lhs, Point rhs)

Parameters

lhs Point
rhs Point

Returns

bool

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

Point

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

Point

operator !=(Point, Point)

Determines whether two points differ in any coordinate.

public static bool operator !=(Point lhs, Point rhs)

Parameters

lhs Point
rhs Point

Returns

bool

operator *(Point, NFloat)

Apply an uniform scale to a point.

public static Point operator *(Point v, NFloat f)

Parameters

v Point
f NFloat

Returns

Point

operator -(Point, Point)

Returns the vector difference from one point to another.

public static Vector operator -(Point lhs, Point rhs)

Parameters

lhs Point
rhs Point

Returns

Vector

operator -(Point, Vector)

Subtracts a vector from a point, offsetting it in the opposite direction.

public static Point operator -(Point lhs, Vector rhs)

Parameters

lhs Point
rhs Vector

Returns

Point