Vector

Vector2: x, y, dot, length, normalized

Vector3: x, y, z, dot, cross, length, normalized

Functions: operator+

struct Vector2<T>: Copyable

A 2D vector.

x

T x;

y

T y;

dot

T dot(Vector2<T> other)

Returns the dot product.

length

float64 length()

Returns the length.

normalized

Vector2<T> normalized()

Returns the vector scaled to unit length. Only meaningful for floating-point elements.

struct Vector3<T>: Copyable

A 3D vector.

x

T x;

y

T y;

z

T z;

dot

T dot(Vector3<T> other)

Returns the dot product.

cross

Vector3<T> cross(Vector3<T> other)

Returns the cross product.

length

float64 length()

Returns the length.

normalized

Vector3<T> normalized()

Returns the vector scaled to unit length. Only meaningful for floating-point elements.

operator+

Vector2<T> operator+<T>(Vector2<T> a, Vector2<T> b)

Returns the component-wise sum.

Vector3<T> operator+<T>(Vector3<T> a, Vector3<T> b)

Returns the component-wise sum.