GeometryServices
Namespace: Murder.Services
Assembly: Murder.dll
public static class GeometryServices
⭐ Methods
CheckOverlap(float, float, float, float)
public bool CheckOverlap(float minA, float maxA, float minB, float maxB)
Check if two ranges overlap at any point.
Parameters
minA
float
maxA
float
minB
float
maxB
float
Returns
bool
CheckOverlap(ValueTuple<T1, T2>, ValueTuple<T1, T2>)
public bool CheckOverlap(ValueTuple<T1, T2> a, ValueTuple<T1, T2> b)
Check if two ranges overlap at any point.
Parameters
a
ValueTuple<T1, T2>
b
ValueTuple<T1, T2>
Returns
bool
InRect(float, float, Rectangle)
public bool InRect(float x, float y, Rectangle rect)
Check for a point in a rectangle.
Parameters
x
float
y
float
rect
Rectangle
Returns
bool
InRect(float, float, float, float, float, float)
public bool InRect(float x, float y, float rx, float ry, float rw, float rh)
Check for a point in a rectangle.
Parameters
x
float
y
float
rx
float
ry
float
rw
float
rh
float
Returns
bool
InRect(Vector2, Rectangle)
public bool InRect(Vector2 xy, Rectangle rect)
Check for a point in a rectangle.
Parameters
xy
Vector2
rect
Rectangle
Returns
bool
IntersectsCircle(Rectangle, Vector2, float)
public bool IntersectsCircle(Rectangle rectangle, Vector2 circleCenter, float circleRadiusSquared)
Parameters
rectangle
Rectangle
circleCenter
Vector2
circleRadiusSquared
float
Returns
bool
IsConvex(Vector2[], bool)
public bool IsConvex(Vector2[] vertices, bool isClockwise)
Determines if a polygon is convex or not.
Parameters
vertices
Vector2[]
isClockwise
bool
Returns
bool
IsValidPosition(IntRectangle[], Vector2, Point)
public bool IsValidPosition(IntRectangle[] area, Vector2 endPosition, Point size)
Checks whether
Parameters
area
IntRectangle[]
endPosition
Vector2
size
Point
Returns
bool
Decimals(float)
public float Decimals(float x)
Parameters
x
float
Returns
float
Distance(float, float, float, float)
public float Distance(float x1, float y1, float x2, float y2)
Distance check.
Parameters
x1
float
y1
float
x2
float
y2
float
Returns
float
DistanceLinePoint(float, float, float, float, float, float)
public float DistanceLinePoint(float x, float y, float x1, float y1, float x2, float y2)
Distance between a line and a point.
Parameters
x
float
y
float
x1
float
y1
float
x2
float
y2
float
Returns
float
DistanceRectPoint(float, float, float, float, float, float)
public float DistanceRectPoint(float px, float py, float rx, float ry, float rw, float rh)
Find the distance between a point and a rectangle.
Parameters
px
float
py
float
rx
float
ry
float
rw
float
rh
float
Returns
float
RoundedDecimals(float)
public float RoundedDecimals(float x)
Parameters
x
float
Returns
float
SignedPolygonArea(Vector2[])
public float SignedPolygonArea(Vector2[] vertices)
Calculates the signed area of a polygon. The signed area is positive if the vertices are in clockwise order, and negative if the vertices are in counterclockwise order.
Parameters
vertices
Vector2[]
Returns
float
GetOuterIntersection(Rectangle, Rectangle)
public IList<T> GetOuterIntersection(Rectangle a, Rectangle b)
Returns the area of
Parameters
a
Rectangle
b
Rectangle
Returns
IList<T>
Shrink(Rectangle, int)
public Rectangle Shrink(Rectangle rectangle, int amount)
Parameters
rectangle
Rectangle
amount
int
Returns
Rectangle
PointInCircleEdge(float)
public Vector2 PointInCircleEdge(float percent)
Parameters
percent
float
Returns
Vector2
CreateCircle(double, int)
public Vector2[] CreateCircle(double radius, int sides)
Creates a list of vectors that represents a circle
Parameters
radius
double
sides
int
Returns
Vector2[]
CreateOrGetCircle(Vector2, int)
public Vector2[] CreateOrGetCircle(Vector2 size, int sides)
Gets or creates a list of vectors that represents a circle using a rectangle as a base
Parameters
size
Vector2
sides
int
Returns
Vector2[]
CreateOrGetFlattenedCircle(float, float, int)
public Vector2[] CreateOrGetFlattenedCircle(float radius, float scaleY, int sides)
Parameters
radius
float
scaleY
float
sides
int
Returns
Vector2[]
⚡