Struct Point3
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
Fields
One
A point at (1, 1, 1).
public static readonly Point3 One
Field Value
X
The X coordinate of the point.
public float X
Field Value
Y
The Y coordinate of the point.
public float Y
Field Value
Z
The Z coordinate of the point.
public float Z
Field Value
Zero
A point at the origin (0, 0, 0).
public static readonly Point3 Zero
Field Value
Methods
Distance(Point3, Point3)
Returns the Euclidean distance between two points.
public static float Distance(Point3 a, Point3 b)
Parameters
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
otherPoint3
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(Point3, Point3, float)
Linearly interpolates between two points by the factor t.
public static Point3 Lerp(Point3 start, Point3 end, float t)
Parameters
startPoint3The start point at t = 0.
endPoint3The end point at t = 1.
tfloatThe interpolation factor, typically in the range [0, 1].
Returns
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
Returns
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
Returns
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
Returns
operator ==(Point3, Point3)
Determines whether two points have equal coordinates.
public static bool operator ==(Point3 lhs, Point3 rhs)
Parameters
Returns
explicit operator Point3(Vector3)
public static explicit operator Point3(Vector3 v)
Parameters
vVector3
Returns
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
Returns
operator !=(Point3, Point3)
Determines whether two points differ in any coordinate.
public static bool operator !=(Point3 lhs, Point3 rhs)
Parameters
Returns
operator *(Point3, float)
Applies a uniform scale to a point relative to the origin.
public static Point3 operator *(Point3 p, float f)
Parameters
Returns
operator -(Point3, Point3)
Returns the vector from rhs to lhs.
public static Vector3 operator -(Point3 lhs, Point3 rhs)
Parameters
Returns
operator -(Point3, Vector3)
Offsets a point in the opposite direction of a vector.
public static Point3 operator -(Point3 p, Vector3 v)