Math module

length_squared

procedure · 3 overloadsSource

The squared length of a vector, dot(a, a). Cheaper than length for comparisons; it can overflow to infinity where length does not.

ExampleOpen in playground ↗
assert(length_squared(xyz(1, 2, 2)) == 9);
length_squared :: (a: Vector2) -> float

The squared length of a. Skips the square root.

Parameters

a: Vector2
the vector to measure.

Returns

float
length_squared :: (a: Vector3) -> float

The squared length of a. Skips the square root.

Parameters

a: Vector3
the vector to measure.

Returns

float
length_squared :: (a: Vector4) -> float

The squared length of a. Skips the square root.

Parameters

a: Vector4
the vector to measure.

Returns

float

See also