sbylib.math.vector

Undocumented in source.

Members

Aliases

ivec2
alias ivec2 = Vector!(int, 2)
Undocumented in source.
ivec3
alias ivec3 = Vector!(int, 3)
Undocumented in source.
ivec4
alias ivec4 = Vector!(int, 4)
Undocumented in source.
vec2
alias vec2 = Vector!(float, 2)
Undocumented in source.
vec3
alias vec3 = Vector!(float, 3)
Undocumented in source.
vec4
alias vec4 = Vector!(float, 4)
Undocumented in source.

Enums

isVector
eponymoustemplate isVector(T)
Undocumented in source.

Functions

approxEqual
bool approxEqual(Vector!(T, N) a, Vector!(T, N) b, T eps)

Returns true if the distance between the given two point is less than eps.

computeSignedVolume
T computeSignedVolume(Vector!(T, 3)[4] positions)

Calculates a signed volume of a tetrahedron which is composed of the given points.

computeUnSignedArea
T computeUnSignedArea(Vector!(T, 3)[3] positions)

Calculates an unsigned area of a triangle which is composed of the given points.

cross
CommonType!(T, S) cross(Vector!(T, 2) v, Vector!(S, 2) v2)

Calclates cross product of two vectors in 2D. Returned value is |v||v2| sin a

cross
Vector!(CommonType!(T, S), 3) cross(Vector!(T, 3) v, Vector!(S, 3) v2)

Calclates cross product of two vectors in 3D.

dot
CommonType!(T, S) dot(Vector!(T, U) v, Vector!(S, U) v2)

Calculates dot product.

length
T length(Vector!(T, U) v)

Returns length of the given vector.

lengthSq
T lengthSq(Vector!(T, U) v)

Returns squared length of the given vector.

max
Vector!(CommonType!(T, S), U) max(Vector!(T, U) v, Vector!(S, U) v2)

Get a vector whose each element is maximum value of the same indexed element of two vectors.

min
Vector!(CommonType!(T, S), U) min(Vector!(T, U) v, Vector!(S, U) v2)

Get a vector whose each element is minimum value of the same indexed element of two vectors.

mix
Vector!(T, U) mix(Vector!(T, U) v1, Vector!(T, U) v2, T t)

Returns a linear interpolated vector

mostDispersionBasis
Vector!(T, 3)[3] mostDispersionBasis(Vector!(T, 3)[] vertices)

Returns normalized orthognal basis which maximize the dispersion of the given points

normalize
Vector!(T, U) normalize(Vector!(T, U) v)

Returns a vector whose length 1 from target vector.

ortho
Vector!(T, 2) ortho(Vector!(T, 2) v)

Returns a vector which is orthognal to the given vector.

ortho
Vector!(T, 3) ortho(Vector!(T, 3) v)

Returns a vector which is orthognal to the given vector.

reduceV
Vector!(T, U) reduceV(Vector!(T, U)[] v)

Reduces an array of vector by the given function.

safeNormalize
Vector!(T, U) safeNormalize(Vector!(T, U) v)

Returns a vector whose length 1 from target vector. When the length is 0, returns zero vector.

Structs

Vector
struct Vector(T, uint S)

Vector type

Meta