Point
Namespace: Murder.Core.Geometry
Assembly: Murder.dll
public sealed struct Point : IEquatable<T>
Represents a single point with coordinates Point.Y. Points are also often used to store sizes, with X marking the right of an object and Y marking its bottom.
Implements: IEquatable<T>
⭐ Constructors
public Point(float x, float y)
Creates a point by rounding the x and y parameters.
public Point(int v)
Creates a point where both x and y and equal to v.
Parameters
v
int
public Point(int x, int y)
Creates a point.
⭐ Properties
Down
public static Point Down { get; }
Point with coordinates X = 0 and Y = 1.
Returns
Point
Flipped
public static Point Flipped { get; }
Point with coordinates X = -1 and Y = 1 (multiply your point by this and you get its mirror).
Returns
Point
HalfCell
public static Point HalfCell { get; }
Represents half a cell on the current Grid.
Returns
Point
One
public static Point One { get; }
Point with coordinates X = 1 and Y = 1.
Returns
Point
X
public int X;
The value of X in this point.
Returns
int
XY
public ValueTuple<T1, T2> XY { get; }
Destructuring helper for obtaining a tuple from this point.
Returns
ValueTuple<T1, T2>
Y
public int Y;
The value of Y in this point.
Returns
int
Zero
public static Point Zero { get; }
Point with coordinates X = 0 and Y = 0.
Returns
Point
⭐ Methods
Length()
public float Length()
Calculates the length of this point.
Returns
float
LengthSquared()
public int LengthSquared()
Returns the length of this point, squared (IOW: X * X + Y * Y).
Returns
int
Max(Point)
public Point Max(Point other)
Parameters
other
Point
Returns
Point
Min(Point)
public Point Min(Point other)
Parameters
other
Point
Returns
Point
Mirror(Point)
public Point Mirror(Point center)
Returns the mirror of this point across the X axis relative to the center point
Parameters
center
Point
Returns
Point
Scale(Point)
public Point Scale(Point other)
Equivalent to this * other.
Parameters
other
Point
Returns
Point
ToWorldPosition()
public Point ToWorldPosition()
Converts this point into a world position by multiplying it by the cell size.
Returns
Point
BreakInTwo()
public ValueTuple<T1, T2> BreakInTwo()
Deconstruction helper for obtaining a tuple from this point.
Returns
ValueTuple<T1, T2>
ToVector2()
public Vector2 ToVector2()
Converts this point into a Vector2 with the same X and Y values.
Returns
Vector2
ToVector3()
public Vector3 ToVector3()
Returns
Vector3
Equals(Point)
public virtual bool Equals(Point other)
Compares whether the point
Parameters
other
Point
Returns
bool
Equals(Object)
public virtual bool Equals(Object obj)
Parameters
obj
Object
Returns
bool
GetHashCode()
public virtual int GetHashCode()
Returns
int
ToString()
public virtual string ToString()
Returns
string
Deconstruct(out Int32&, out Int32&)
public void Deconstruct(Int32& x, Int32& y)
⚡