Table of Contents

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

x1 double

The X-coordinate of the first point.

y1 double

The Y-coordinate of the first point.

x2 double

The X-coordinate of the second point.

y2 double

The 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

point1 Vector2

The first 2D point.

point2 Vector2

The second 2D point.

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

x1 float

The X-coordinate of the first point.

y1 float

The Y-coordinate of the first point.

x2 float

The X-coordinate of the second point.

y2 float

The 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

x1 double

The X-coordinate of the first point.

y1 double

The Y-coordinate of the first point.

z1 double

The Z-coordinate of the first point.

x2 double

The X-coordinate of the second point.

y2 double

The Y-coordinate of the second point.

z2 double

The 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

point1 Vector3

The first point.

point2 Vector3

Thesecond point.

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

x1 float

The X-coordinate of the first point.

y1 float

The Y-coordinate of the first point.

z1 float

The Z-coordinate of the first point.

x2 float

The X-coordinate of the second point.

y2 float

The Y-coordinate of the second point.

z2 float

The 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

x1 double

The X coordinate of the first point.

y1 double

The Y coordinate of the first point.

x2 double

The X coordinate of the second point.

y2 double

The 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

point1 Vector2

The first point.

point2 Vector2

The second point.

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

x1 float

The X coordinate of the first point.

y1 float

The Y coordinate of the first point.

x2 float

The X coordinate of the second point.

y2 float

The 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

angle double

The 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

angle float

The 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

x double

The X component of the incident vector.

y double

The Y component of the incident vector.

normalX double

The X component of the surface normal (should be normalized).

normalY double

The Y component of the surface normal (should be normalized).

Returns

(double x, double y)

A tuple containing the X and Y components of the reflected vector.

Reflect(Vector2, Vector2)

Reflects a 2D vector off a surface defined by a normal vector.

public static Vector2 Reflect(Vector2 vector, Vector2 normal)

Parameters

vector Vector2

The incident vector.

normal Vector2

The surface normal (should be normalized).

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

x float

The X component of the incident vector.

y float

The Y component of the incident vector.

normalX float

The X component of the surface normal (should be normalized).

normalY float

The Y component of the surface normal (should be normalized).

Returns

(float x, float y)

A tuple containing the X and Y components of the reflected vector.

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

x double

The X component of the incident vector.

y double

The Y component of the incident vector.

z double

The Z component of the incident vector.

normalX double

The X component of the surface normal (should be normalized).

normalY double

The Y component of the surface normal (should be normalized).

normalZ double

The 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

vector Vector3

The incident vector.

normal Vector3

The surface normal (should be normalized).

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

x float

The X component of the incident vector.

y float

The Y component of the incident vector.

z float

The Z component of the incident vector.

normalX float

The X component of the surface normal (should be normalized).

normalY float

The Y component of the surface normal (should be normalized).

normalZ float

The Z component of the surface normal (should be normalized).

Returns

(float x, float y, float z)

A tuple containing the X, Y, and Z components of the reflected vector.

ToDegrees(double)

Converts an angle from radians to degrees.

public static double ToDegrees(double radians)

Parameters

radians double

The 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

radians float

The 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

degrees double

The 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

degrees float

The angle in degrees.

Returns

float

The angle in radians.