geom v1.0.0 Geom.Shape.Vector protocol

A protocol with the functions to be implemented by the vectors of different dimensions.

Summary

Functions

Returns a vector with the coordinates of the two given vector summed 2 by 2, or the scalar added to each coord

Returns the distance between two vectors

Returns a vector with the coordinates of the given vector divided by the given scalar

Returns the dot product of the two given vectors

Returns whether two vectors are equal within an epsilon error value

Returns a vector with the coordinates of the given vector multiplied by the given scalar

Returns the length of the given vector

Returns a vector with the coordinates of the two given vector subtracted 2 by 2, or the scalar subtracted from each coord

Returns a vector of length one with the same direction as the given vector

Types

t()
t :: tuple

Functions

add(vector1, vector_or_scalar)

Returns a vector with the coordinates of the two given vector summed 2 by 2, or the scalar added to each coord.

dist(vector1, vector2)

Returns the distance between two vectors.

div(vector, scalar)

Returns a vector with the coordinates of the given vector divided by the given scalar.

dot(vector1, vector2)

Returns the dot product of the two given vectors.

equal(vector1, vector2, epsilon)

Returns whether two vectors are equal within an epsilon error value.

mul(vector, scalar)

Returns a vector with the coordinates of the given vector multiplied by the given scalar.

norm(vector)

Returns the length of the given vector.

sub(vector1, vector_or_scalar)

Returns a vector with the coordinates of the two given vector subtracted 2 by 2, or the scalar subtracted from each coord.

unit(vector)

Returns a vector of length one with the same direction as the given vector.