module Three: V
Three-element vector
type
t
val dimension : int
val get : t -> int -> float
Return a given element of a vector
val set : t -> int -> float -> unit
Sets a given element of a vector
val make : float -> t
make val
returns a new vector, all elements of which are
filled with val
val from_array : float array -> t
Return a new vector filled by the given array.
val to_array : t -> float array
Return an array representation of the vector.
val add : t -> t -> t
Vector addition
val sub : t -> t -> t
Vector subtraction
val mul : t -> t -> t
Vector multiplication
val muls : t -> float -> t
Multiplication of a scalar
val dot_product : t -> t -> float
Calculate the dot product of two vectors
val magnitude : t -> float
Calculate the magnitude of a vector.
val unit_vector : t -> t
Return the unit vector that points in the same direction as the
given vector.