Table of Contents

Struct Point3

Namespace
Xui.Core.Math3D
Assembly
Xui.Core.dll

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

public struct Point3
Inherited Members

Remarks

A Point3 denotes a position. The difference of two points yields a Vector3. Adding a Vector3 to a Point3 offsets it.

Constructors

Point3(float, float, float)

Initializes a new Point3 with the specified coordinates.

public Point3(float x, float y, float z)

Parameters

x float

The X coordinate.

y float

The Y coordinate.

z float

The Z coordinate.

Fields

One

A point at (1, 1, 1).

public static readonly Point3 One

Field Value

Point3

X

The X coordinate of the point.

public float X

Field Value

float

Y

The Y coordinate of the point.

public float Y

Field Value

float

Z

The Z coordinate of the point.

public float Z

Field Value

float

Zero

A point at the origin (0, 0, 0).

public static readonly Point3 Zero

Field Value

Point3

Methods

Distance(Point3, Point3)

Returns the Euclidean distance between two points.

public static float Distance(Point3 a, Point3 b)

Parameters

a Point3
b Point3

Returns

float

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(Point3)

Returns true if this point has the same coordinates as another.

public bool Equals(Point3 other)

Parameters

other Point3

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(Point3, Point3, float)

Linearly interpolates between two points by the factor t.

public static Point3 Lerp(Point3 start, Point3 end, float t)

Parameters

start Point3

The start point at t = 0.

end Point3

The end point at t = 1.

t float

The interpolation factor, typically in the range [0, 1].

Returns

Point3

SquaredDistance(Point3, Point3)

Returns the squared Euclidean distance between two points (no square root). Useful for performance comparisons or ordering by proximity.

public static float SquaredDistance(Point3 a, Point3 b)

Parameters

a Point3
b Point3

Returns

float

TaxicabDistance(Point3, Point3)

Returns the Manhattan (taxicab) distance between two points. This is the sum of the absolute differences of their coordinates.

public static float TaxicabDistance(Point3 a, Point3 b)

Parameters

a Point3
b Point3

Returns

float

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(Point3, Vector3)

Offsets a point by a vector.

public static Point3 operator +(Point3 p, Vector3 v)

Parameters

p Point3
v Vector3

Returns

Point3

operator ==(Point3, Point3)

Determines whether two points have equal coordinates.

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

Parameters

lhs Point3
rhs Point3

Returns

bool

explicit operator Point3(Vector3)

Explicitly converts a Vector3 to a Point3.

public static explicit operator Point3(Vector3 v)

Parameters

v Vector3

Returns

Point3

implicit operator Point3((float x, float y, float z))

Implicitly converts a tuple to a Point3.

public static implicit operator Point3((float x, float y, float z) t)

Parameters

t (float x, float y, float z)

Returns

Point3

operator !=(Point3, Point3)

Determines whether two points differ in any coordinate.

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

Parameters

lhs Point3
rhs Point3

Returns

bool

operator *(Point3, float)

Applies a uniform scale to a point relative to the origin.

public static Point3 operator *(Point3 p, float f)

Parameters

p Point3
f float

Returns

Point3

operator -(Point3, Point3)

Returns the vector from rhs to lhs.

public static Vector3 operator -(Point3 lhs, Point3 rhs)

Parameters

lhs Point3
rhs Point3

Returns

Vector3

operator -(Point3, Vector3)

Offsets a point in the opposite direction of a vector.

public static Point3 operator -(Point3 p, Vector3 v)

Parameters

p Point3
v Vector3

Returns

Point3