Cauldron3D.Vec (Cauldron3D v0.2.2)

Copy Markdown View Source

Three-component vectors as {x, y, z} float tuples.

Cauldron3D.Vec.add({1.0, 0.0, 0.0}, {0.0, 2.0, 0.0})
#=> {1.0, 2.0, 0.0}

Summary

Functions

The cross product.

The dot product.

The vector as floats.

The length.

The point t of the way from a to b.

a + b * s.

Each component the larger of the two.

Each component the smaller of the two.

The vector scaled to length one; the zero vector stays zero.

v * s.

The zero vector.

Types

t()

@type t() :: {float(), float(), float()}

Functions

add(arg1, arg2)

@spec add(t(), t()) :: t()

a + b.

cross(arg1, arg2)

@spec cross(t(), t()) :: t()

The cross product.

dot(arg1, arg2)

@spec dot(t(), t()) :: float()

The dot product.

float(arg)

@spec float({number(), number(), number()}) :: t()

The vector as floats.

length(v)

@spec length(t()) :: float()

The length.

lerp(a, b, t)

@spec lerp(t(), t(), number()) :: t()

The point t of the way from a to b.

madd(arg1, arg2, s)

@spec madd(t(), t(), number()) :: t()

a + b * s.

max(arg1, arg2)

@spec max(t(), t()) :: t()

Each component the larger of the two.

min(arg1, arg2)

@spec min(t(), t()) :: t()

Each component the smaller of the two.

normalize(v)

@spec normalize(t()) :: t()

The vector scaled to length one; the zero vector stays zero.

scale(arg, s)

@spec scale(t(), number()) :: t()

v * s.

sub(arg1, arg2)

@spec sub(t(), t()) :: t()

a - b.

zero()

@spec zero() :: t()

The zero vector.