{ x : Basics.Float
, y : Basics.Float
, z : Basics.Float
}
Three dimensional vector type
vec3 : Basics.Float -> Basics.Float -> Basics.Float -> Vec3
Creates a new 3-element vector with the given values.
i : Vec3
The unit vector î which points in the x direction: vec3 1 0 0
j : Vec3
The unit vector ĵ which points in the y direction: vec3 0 1 0
k : Vec3
The unit vector k̂ which points in the z direction: vec3 0 0 1
The set functions create a new copy of the vector, updating a single field.
getX : Vec3 -> Basics.Float
Extract the x component of a vector.
getY : Vec3 -> Basics.Float
Extract the y component of a vector.
getZ : Vec3 -> Basics.Float
Extract the z component of a vector.
setX : Basics.Float -> Vec3 -> Vec3
Update the x component of a vector, returning a new vector.
setY : Basics.Float -> Vec3 -> Vec3
Update the y component of a vector, returning a new vector.
setZ : Basics.Float -> Vec3 -> Vec3
Update the z component of a vector, returning a new vector.
add : Vec3 -> Vec3 -> Vec3
Vector addition: a + b
sub : Vec3 -> Vec3 -> Vec3
Vector subtraction: a - b
negate : Vec3 -> Vec3
Vector negation: -a
scale : Basics.Float -> Vec3 -> Vec3
Multiply the vector by a scalar: s * v
dot : Vec3 -> Vec3 -> Basics.Float
The dot product of a and b
cross : Vec3 -> Vec3 -> Vec3
The cross product of a and b
normalize : Vec3 -> Vec3
A unit vector with the same direction as the given vector: a / |a|
direction : Vec3 -> Vec3 -> Vec3
The normalized direction from b to a: (a - b) / |a - b|
length : Vec3 -> Basics.Float
The length of the given vector: |a|
lengthSquared : Vec3 -> Basics.Float
The square of the length of the given vector: |a| * |a|
distance : Vec3 -> Vec3 -> Basics.Float
The distance between two vectors.
distanceSquared : Vec3 -> Vec3 -> Basics.Float
The square of the distance between two vectors.
toRecord : Vec3 -> { x : Basics.Float, y : Basics.Float, z : Basics.Float }
Convert a vector to a record.
fromRecord : { x : Basics.Float, y : Basics.Float, z : Basics.Float } -> Vec3
Convert a record to a vector.