Class GeometryGm
- Namespace
- Gamem
- Assembly
- Gamem.dll
Provides static methods for Geometry calculations
public static class GeometryGm
- Inheritance
-
GeometryGm
- Inherited Members
Methods
GetDistance(double, double, double, double)
Calculates the Euclidean distance between two points in a 2D plane.
public static double GetDistance(double x1, double y1, double x2, double y2)
Parameters
x1doubleThe X-coordinate of the first point.
y1doubleThe Y-coordinate of the first point.
x2doubleThe X-coordinate of the second point.
y2doubleThe Y-coordinate of the second point.
Returns
- double
The distance between the two points in 2D space.
GetDistance(Vector2, Vector2)
Calculates the Euclidean distance between two points in a 2D plane.
public static float GetDistance(Vector2 point1, Vector2 point2)
Parameters
Returns
- float
The distance between the two points in 2D space.
GetDistance(float, float, float, float)
Calculates the Euclidean distance between two points in a 2D plane.
public static float GetDistance(float x1, float y1, float x2, float y2)
Parameters
x1floatThe X-coordinate of the first point.
y1floatThe Y-coordinate of the first point.
x2floatThe X-coordinate of the second point.
y2floatThe Y-coordinate of the second point.
Returns
- float
The distance between the two points in 2D space.
GetDistance3D(double, double, double, double, double, double)
Calculates the Euclidean distance between two points in 3D space.
public static double GetDistance3D(double x1, double y1, double z1, double x2, double y2, double z2)
Parameters
x1doubleThe X-coordinate of the first point.
y1doubleThe Y-coordinate of the first point.
z1doubleThe Z-coordinate of the first point.
x2doubleThe X-coordinate of the second point.
y2doubleThe Y-coordinate of the second point.
z2doubleThe Z-coordinate of the second point.
Returns
- double
The distance between the two points in 3D space.
GetDistance3D(Vector3, Vector3)
Calculates the Euclidean distance between two points in 3D space.
public static float GetDistance3D(Vector3 point1, Vector3 point2)
Parameters
Returns
- float
The distance between the two points in 3D space.
GetDistance3D(float, float, float, float, float, float)
Calculates the Euclidean distance between two points in 3D space.
public static float GetDistance3D(float x1, float y1, float z1, float x2, float y2, float z2)
Parameters
x1floatThe X-coordinate of the first point.
y1floatThe Y-coordinate of the first point.
z1floatThe Z-coordinate of the first point.
x2floatThe X-coordinate of the second point.
y2floatThe Y-coordinate of the second point.
z2floatThe Z-coordinate of the second point.
Returns
- float
The distance between the two points in 3D space.
GetDistanceSquared(double, double, double, double)
Calculates the squared distance between two 2D points.
public static double GetDistanceSquared(double x1, double y1, double x2, double y2)
Parameters
x1doubleThe X coordinate of the first point.
y1doubleThe Y coordinate of the first point.
x2doubleThe X coordinate of the second point.
y2doubleThe Y coordinate of the second point.
Returns
- double
The squared distance between the two points, avoiding an expensive square root operation.
GetDistanceSquared(Vector2, Vector2)
Calculates the squared distance between two 2D points.
public static float GetDistanceSquared(Vector2 point1, Vector2 point2)
Parameters
Returns
- float
The squared distance between the two points, avoiding an expensive square root operation.
GetDistanceSquared(float, float, float, float)
Calculates the squared distance between two 2D points.
public static float GetDistanceSquared(float x1, float y1, float x2, float y2)
Parameters
x1floatThe X coordinate of the first point.
y1floatThe Y coordinate of the first point.
x2floatThe X coordinate of the second point.
y2floatThe Y coordinate of the second point.
Returns
- float
The squared distance between the two points, avoiding an expensive square root operation.
NormalizeAngle(double)
Normalizes an angle in degrees into the range [0, 360).
public static double NormalizeAngle(double angle)
Parameters
angledoubleThe input angle in degrees to normalize.
Returns
- double
The equivalent angle wrapped within the range of 0 (inclusive) to 360 (exclusive) degrees.
NormalizeAngle(float)
Normalizes an angle in degrees into the range [0, 360).
public static float NormalizeAngle(float angle)
Parameters
anglefloatThe input angle in degrees to normalize.
Returns
- float
The equivalent angle wrapped within the range of 0 (inclusive) to 360 (exclusive) degrees.
Reflect(double, double, double, double)
Reflects a 2D vector off a surface defined by a normal vector.
public static (double x, double y) Reflect(double x, double y, double normalX, double normalY)
Parameters
xdoubleThe X component of the incident vector.
ydoubleThe Y component of the incident vector.
normalXdoubleThe X component of the surface normal (should be normalized).
normalYdoubleThe Y component of the surface normal (should be normalized).
Returns
Reflect(Vector2, Vector2)
Reflects a 2D vector off a surface defined by a normal vector.
public static Vector2 Reflect(Vector2 vector, Vector2 normal)
Parameters
Returns
- Vector2
The X and Y components of the reflected vector.
Reflect(float, float, float, float)
Reflects a 2D vector off a surface defined by a normal vector.
public static (float x, float y) Reflect(float x, float y, float normalX, float normalY)
Parameters
xfloatThe X component of the incident vector.
yfloatThe Y component of the incident vector.
normalXfloatThe X component of the surface normal (should be normalized).
normalYfloatThe Y component of the surface normal (should be normalized).
Returns
Reflect3D(double, double, double, double, double, double)
Reflects a 3D vector off a surface defined by a normal vector.
public static (double x, double y, double z) Reflect3D(double x, double y, double z, double normalX, double normalY, double normalZ)
Parameters
xdoubleThe X component of the incident vector.
ydoubleThe Y component of the incident vector.
zdoubleThe Z component of the incident vector.
normalXdoubleThe X component of the surface normal (should be normalized).
normalYdoubleThe Y component of the surface normal (should be normalized).
normalZdoubleThe Z component of the surface normal (should be normalized).
Returns
- (double x, double y, double z)
A tuple containing the X, Y, and Z components of the reflected vector.
Reflect3D(Vector3, Vector3)
Reflects a 3D vector off a surface defined by a normal vector.
public static Vector3 Reflect3D(Vector3 vector, Vector3 normal)
Parameters
Returns
- Vector3
The X, Y, and Z components of the reflected vector.
Reflect3D(float, float, float, float, float, float)
Reflects a 3D vector off a surface defined by a normal vector.
public static (float x, float y, float z) Reflect3D(float x, float y, float z, float normalX, float normalY, float normalZ)
Parameters
xfloatThe X component of the incident vector.
yfloatThe Y component of the incident vector.
zfloatThe Z component of the incident vector.
normalXfloatThe X component of the surface normal (should be normalized).
normalYfloatThe Y component of the surface normal (should be normalized).
normalZfloatThe Z component of the surface normal (should be normalized).
Returns
ToDegrees(double)
Converts an angle from radians to degrees.
public static double ToDegrees(double radians)
Parameters
radiansdoubleThe angle in radians.
Returns
- double
The angle in degrees.
ToDegrees(float)
Converts an angle from radians to degrees.
public static float ToDegrees(float radians)
Parameters
radiansfloatThe angle in radians.
Returns
- float
The angle in degrees.
ToRadians(double)
Converts an angle from degrees to radians.
public static double ToRadians(double degrees)
Parameters
degreesdoubleThe angle in degrees.
Returns
- double
The angle in radians.
ToRadians(float)
Converts an angle from degrees to radians.
public static float ToRadians(float degrees)
Parameters
degreesfloatThe angle in degrees.
Returns
- float
The angle in radians.