Quaternion

Struct repesentation of quaterion

Constructors

this
this(float val)
this(float[4] vals)

Constructs quaternion from single value or array of values

this
this(float[3] vals)

Construct quaternion from euler angles

this
this(mat4 m)

Constructs quaterion from rotation matrix

this
this(vec3 axis, float angle)

Constructs quaternion from axis angle

Alias This

data

Alias to allow easy data access

Members

Aliases

normalise
alias normalise = normalize

Normalises quaternion in place

normalised
alias normalised = normalized

Normalises quaternion

Functions

angle
double angle(quat b)

Calculates angle between two quaternions

axisAngle
void axisAngle(vec3 axis, float angle)

Returns rotation angle and axis

copyof
quat copyof()

Returns copy of quaterion

dot
double dot(quat b)

Performs dot product

isClose
bool isClose(quat v)

Is quaternion approximately close to v

length
double length()

Returns quaternion length

lengthSquared
float lengthSquared()

Returns squared quaternion length

lerp
quat lerp(quat to, double weight)

Linearly interpolates quaternion

nlerp
quat nlerp(quat to, double weight)

Normalized lerp

normalize
quat normalize()

Normalises quaternion in place

normalized
quat normalized()

Normalises quaternion

opBinary
quat opBinary(Vector!(R, 4) b)

opBinary x [+, -, *, /, %] y

opBinary
quat opBinary(quat b)
quat opBinary(R b)
opBinaryRight
quat opBinaryRight(Vector!(R, 4) b)
quat opBinaryRight(R b)

opBinary x [+, -, *, /, %] y

opCast
R opCast()

opCast cast(x) y

opCast
bool opCast()

Cast to bool

opCmp
int opCmp(Vector!(R, size) b)

opCmp x [< > <= >=] y

opCmp
int opCmp(quat b)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Vector!(R, size) b)
bool opEquals(quat b)

opEquals x == y

opOpAssign
quat opOpAssign(Vector!(R, 4) b)

opOpAssign x [+, -, *, /, %]= y

opOpAssign
quat opOpAssign(quat b)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
VecType opOpAssign(R b)

opOpAssign x [+, -, *, /, %]= y

opUnary
quat opUnary()

opUnary [-, +, --, ++] x

opUnary
quat opUnary()

Invert quaternion

ptr
float* ptr()

Returns pointer to data

slerp
quat slerp(quat to, double weight)

Spherically interpolates quaternion

toHash
size_t toHash()

Returns hash

toString
string toString()

Returns string representation of quaternion: [1.00, 1.00,... , 1.00]

Mixins

__anonymous
mixin accessByString!(float, 4, "data", AS)

Mixes in swizzle

Static functions

rotation
quat rotation(vec3 from, vec3 to)

Calculates quaternion based on rotation between from and to

Variables

data
float[4] data;

Quat data

Mixed In Members

From mixin accessByString!(float, 4, "data", AS)

opDispatch
T opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
T opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
auto opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
U opDispatch [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta