Math module

distance_squared

procedure · 3 overloadsSource

The squared distance between two points, length_squared(a - b).

ExampleOpen in playground ↗
assert(distance_squared(xy(1, 1), xy(4, 5)) == 25);
distance_squared :: (a: Vector2, b: Vector2) -> float

The squared distance between two points. Skips the square root.

Parameters

a: Vector2
the first point.
b: Vector2
the second point.

Returns

float
distance_squared :: (a: Vector3, b: Vector3) -> float

The squared distance between two points. Skips the square root.

Parameters

a: Vector3
the first point.
b: Vector3
the second point.

Returns

float
distance_squared :: (a: Vector4, b: Vector4) -> float

The squared distance between two points. Skips the square root.

Parameters

a: Vector4
the first point.
b: Vector4
the second point.

Returns

float

See also