dlib.math.vector

Vectors of Euclidean space

Members

Aliases

Vector2d
alias Vector2d = Vector!(double, 2)

Alias for 2-vector of doubles

Vector2f
alias Vector2f = Vector!(float, 2)

Alias for 2-vector of floats

Vector2i
alias Vector2i = Vector!(int, 2)

Predefined vector types Alias for 2-vector of ints

Vector2u
alias Vector2u = Vector!(uint, 2)

Alias for 2-vector of uints

Vector3d
alias Vector3d = Vector!(double, 3)

Alias for 2-vector of doubles

Vector3f
alias Vector3f = Vector!(float, 3)

Alias for 3-vector of floats

Vector3i
alias Vector3i = Vector!(int, 3)

Alias for 3-vector of ints

Vector3u
alias Vector3u = Vector!(uint, 3)

Alias for 3-vector of uints

Vector4d
alias Vector4d = Vector!(double, 4)

Alias for 4-vector of doubles

Vector4f
alias Vector4f = Vector!(float, 4)

Alias for 4-vector of floats

Vector4i
alias Vector4i = Vector!(int, 4)

Alias for 4-vector of ints

Vector4u
alias Vector4u = Vector!(uint, 4)

Alias for 4-vector of uints

dvec2
alias dvec2 = Vector2d
Undocumented in source.
dvec3
alias dvec3 = Vector3d
Undocumented in source.
dvec4
alias dvec4 = Vector4d
Undocumented in source.
ivec2
alias ivec2 = Vector2i

GLSL-like short aliases

ivec3
alias ivec3 = Vector3i
Undocumented in source.
ivec4
alias ivec4 = Vector4i
Undocumented in source.
outerProduct
alias outerProduct = tensorProduct
Undocumented in source.
uvec2
alias uvec2 = Vector2u
Undocumented in source.
uvec3
alias uvec3 = Vector3u
Undocumented in source.
uvec4
alias uvec4 = Vector4u
Undocumented in source.
vec2
alias vec2 = Vector2f
Undocumented in source.
vec3
alias vec3 = Vector3f
Undocumented in source.
vec4
alias vec4 = Vector4f
Undocumented in source.

Functions

cross
Vector!(T, size) cross(Vector!(T, size) a, Vector!(T, size) b)

Cross product

cross
Vector!(T, size) cross(Vector!(T, size) a, Vector!(T, size) b, Vector!(T, size) c)

Cross product for 4-vectors

distance
T distance(Vector!(T, 2) a, Vector!(T, 2) b)

Compute distance between two 2D points

distance
T distance(Vector!(T, 3) a, Vector!(T, 3) b)

Compute distance between two 3D points

distancesqr
T distancesqr(Vector!(T, 2) a, Vector!(T, 2) b)

Compute squared distance between two 2D points

distancesqr
T distancesqr(Vector!(T, 3) a, Vector!(T, 3) b)

Compute squared distance between two 3D points

dot
T dot(Vector!(T, size) a, Vector!(T, size) b)

Dot product

faceforward
Vector!(T, 3) faceforward(Vector!(T, 3) N, Vector!(T, 3) I, Vector!(T, 3) Nref)
isAlmostZero
bool isAlmostZero(Vector3f v)

Is all elements almost zero

lvector
auto lvector(T x)

L-value pseudovector for assignment purposes.

planeNormal
Vector!(T, 3) planeNormal(Vector!(T, 3) p1, Vector!(T, 3) p2, Vector!(T, 3) p3)

Compute normal of a plane from three points

randomUnitVector2
Vector!(T, 2) randomUnitVector2()

Random unit length 2-vector

randomUnitVector3
Vector!(T, 3) randomUnitVector3()

Random unit length 3-vector

reflect
Vector!(T, 3) reflect(Vector!(T, 3) I, Vector!(T, 3) N)
refract
Vector!(T, 3) refract(Vector!(T, 3) I, Vector!(T, 3) N, T r)
rotateAroundAxis
void rotateAroundAxis(Vector!(T, 3) V, Vector!(T, 3) P, Vector!(T, 3) D, T angle)
slerp
Vector!(T, 3) slerp(Vector!(T, 3) a, Vector!(T, 3) b, T t)

Spherical linear interpolation (simple lerp is in dlib.math.interpolation)

tensorProduct
Matrix!(T, N) tensorProduct(Vector!(T, N) u, Vector!(T, N) v)

Tensor product

vectorDecreaseToZero
Vector!(T, 3) vectorDecreaseToZero(Vector!(T, 3) vector, T step)

Gradually decrease vector to zero length

vectorf
auto vectorf(T t)

Vector factory function

Structs

AxisVector
struct AxisVector

Axis vectors

Vector
struct Vector(T, int size)

Vector representation

Meta

Authors

Timur Gafarov