3DCoatScripting  4.8.31β
You can manage 3DСoat features with help of scripting
coat::scripto::Quat Class Reference

Class for working with quaternions. More...

Public Types

typedef comms::cQuat quat_t
 

Public Member Functions

 Quat ()
 Constructor for building a zero quaternion.
 
 operator Mat3 () const
 Ability for converting Quat to Mat3. More...
 
 operator Mat4 () const
 Ability for converting Quat to Mat4. More...
 
 operator std::string () const
 Ability for converting Quat to string. More...
 
bool operator== (const Quat &b) const
 Comparison. More...
 
bool normalized () const
 Returns TRUE then the quaternion is normalized. More...
 
bool zero () const
 Returns TRUE then the all values of the quaternion is zero.
 
Quatoperator() (int i, float v)
 Setter like array.
[ 0 ] is x
[ 1 ] is y
[ 2 ] is z
[ 3 ] is w
. More...
 
float operator() (int i) const
 Getter like array. More...
 
Quatx (const float &value)
 Setter for x. More...
 
float x () const
 Getter for x. More...
 
Quaty (const float &value)
 Setter for y. More...
 
float y () const
 Getter for y. More...
 
Quatz (const float &value)
 Setter for z. More...
 
float z () const
 Getter for z. More...
 
Quatw (const float &value)
 Setter for w. More...
 
float w () const
 Getter for w. More...
 
Quat operator- () const
 Negation operator. More...
 
Quatoperator+= (const Quat &b)
 
Quatoperator-= (const Quat &b)
 
Quatoperator*= (const Quat &b)
 
Quatoperator*= (const float &k)
 
Quatoperator/= (const Quat &b)
 
Quatoperator/= (const float &k)
 
Quat operator+ (const Quat &b) const
 
Quat operator- (const Quat &b) const
 
Quat operator* (const Quat &b) const
 
Quat operator* (const float &k) const
 
Quat operator/ (const Quat &b) const
 
Quat operator/ (const float &k) const
 
float dot (const Quat &b) const
 Returns a dot product. More...
 
float length () const
 Returns an Euclidean length. More...
 
float lengthSquared () const
 Returns a squared Euclidean length. More...
 
QuatcalcW ()
 Recalculates w by current xyz. More...
 
Quat calcWCopy () const
 
Quatcompress ()
 Set w to 0.0. Change signs of x, y, z if w was less zero. More...
 
Quat compressCopy () const
 
Quatconjugate ()
 Conjugates the quaternion. More...
 
Quat conjugateCopy () const
 
Quatexp ()
 Calculates an exponential. More...
 
Quat expCopy () const
 
Quatinvert ()
 Inverts the quaternion. More...
 
Quat invertCopy () const
 
Quatlerp (const Quat &b, float s)
 Interpolates between quaternions, using linear interpolation. More...
 
Quat lerpCopy (const Quat &b, float s) const
 
Quatln ()
 Calculates a natural logarithm. More...
 
Quat lnCopy () const
 
Quatnormalize ()
 Normalize the quaternion. More...
 
Quat normalizeCopy () const
 
Quatslerp (const Quat &b, float s)
 Interpolates between vectors, using spherical linear interpolation. More...
 
Quat slerpCopy (const Quat &b, float s) const
 

Detailed Description

Class for working with quaternions.

quaternion.png
Since
4.5.32
Quat a( 0 );
// equivalent to
Quat b( 0, 0, 0, 0 );
Quat a( 5, 2, 1, 0 );
Quat b = { 5, 2, 1, 0 };
See Also
Representation `a`

Member Function Documentation

coat::scripto::Quat::operator Mat3 ( ) const

Ability for converting Quat to Mat3.

Quat a( 5, 2, 1, 0 );
auto m = Mat3( a );
coat::scripto::Quat::operator Mat4 ( ) const

Ability for converting Quat to Mat4.

Quat a( 5, 2, 1, 0 );
auto m = Mat4( a );
coat::scripto::Quat::operator std::string ( ) const

Ability for converting Quat to string.

Quat a( 5, 2, 1, 0 );
auto m = string( a );
bool coat::scripto::Quat::operator== ( const Quat b) const
inline

Comparison.

Quat a;
...
if (a == Quat( 5, 2, 1, 0 )) { ... }
bool coat::scripto::Quat::normalized ( ) const
inline

Returns TRUE then the quaternion is normalized.

See Also
normalized()
Quat& coat::scripto::Quat::operator() ( int  i,
float  v 
)
inline

Setter like array.
[ 0 ] is x
[ 1 ] is y
[ 2 ] is z
[ 3 ] is w
.

Quat a( 5, 2, 1, 0 );
// setting `w` to 9
a[ 3, 9 ];
See Also
Representation for new `a`
float coat::scripto::Quat::operator() ( int  i) const
inline

Getter like array.

Quat a( 5, 2, 1, 0 );
float x = a[ 0 ];
float y = a[ 1 ];
float z = a[ 2 ];
float w = a[ 3 ];
Quat& coat::scripto::Quat::x ( const float &  value)
inline

Setter for x.

Quat a( 5, 2, 1, 0 );
a.x( 50 ).y( 20 ).z( 10 ).w( 1 );
See Also
y( float ), z( float ), w (float )
float coat::scripto::Quat::x ( ) const
inline

Getter for x.

Quat a( 5, 2, 1, 0 );
float v = a.x();
See Also
y(), z(), w()
Quat& coat::scripto::Quat::y ( const float &  value)
inline

Setter for y.

See Also
x( float ), z( float ), w(float )
float coat::scripto::Quat::y ( ) const
inline

Getter for y.

See Also
x(), z(), w()
Quat& coat::scripto::Quat::z ( const float &  value)
inline

Setter for z.

See Also
x( float ), y( float ), w(float )
float coat::scripto::Quat::z ( ) const
inline

Getter for z.

See Also
x(), y(), w()
Quat& coat::scripto::Quat::w ( const float &  value)
inline

Setter for w.

See Also
x( float ), y( float ), z(float )
float coat::scripto::Quat::w ( ) const
inline

Getter for w.

See Also
x(), y(), z()
Quat coat::scripto::Quat::operator- ( ) const
inline

Negation operator.

Quat a( 5, 2, 1, 0 );
Quat na = -a;
See Also
Result.
float coat::scripto::Quat::dot ( const Quat b) const
inline

Returns a dot product.

Quat a( 5, 2, 1, 0 );
Quat b( 6, 3, 2, 1 );
float r = a.dot( b );
float coat::scripto::Quat::length ( ) const
inline

Returns an Euclidean length.

Quat a( 5, 2, 1, 0 );
float r = a.length();
See Also
lengthSquared()
float coat::scripto::Quat::lengthSquared ( ) const
inline

Returns a squared Euclidean length.

Quat a( 5, 2, 1, 0 );
float r = a.lengthSquared();
See Also
length()
Quat& coat::scripto::Quat::calcW ( )
inline

Recalculates w by current xyz.

Quat a( 5, 2, 1, 0 );
a.calcW();
Quat coat::scripto::Quat::calcWCopy ( ) const
inline
See Also
calcW()
Quat& coat::scripto::Quat::compress ( )
inline

Set w to 0.0. Change signs of x, y, z if w was less zero.

Quat a( 5, 2, 1, -0.5 );
a.compress();
Quat coat::scripto::Quat::compressCopy ( ) const
inline
See Also
compress()
Quat& coat::scripto::Quat::conjugate ( )
inline

Conjugates the quaternion.

Quat a( 5, 2, 1, 0 );
a.conjugate();
Quat coat::scripto::Quat::conjugateCopy ( ) const
inline
See Also
conjugate()
Quat& coat::scripto::Quat::exp ( )
inline

Calculates an exponential.

Quat a( 5, 2, 1, 0 );
a.exp();
Quat coat::scripto::Quat::expCopy ( ) const
inline
See Also
exp()
Quat& coat::scripto::Quat::invert ( )
inline

Inverts the quaternion.

Quat a( 5, 2, 1, 0 );
a.invert();
Quat coat::scripto::Quat::invertCopy ( ) const
inline
See Also
invert()
Quat& coat::scripto::Quat::lerp ( const Quat b,
float  s 
)
inline

Interpolates between quaternions, using linear interpolation.

Quat a( 5, 2, 1, 0 );
a.lerp( Quat( 6, 3, 2, 1 ), 0.3 );
See Also
slerp()
Quat coat::scripto::Quat::lerpCopy ( const Quat b,
float  s 
) const
inline
See Also
lerp()
Quat& coat::scripto::Quat::ln ( )
inline

Calculates a natural logarithm.

Quat a( 5, 2, 1, 0 );
a.ln();
Quat coat::scripto::Quat::lnCopy ( ) const
inline
See Also
ln()
Quat& coat::scripto::Quat::normalize ( )
inline

Normalize the quaternion.

Quat a( 45, 70, 80 );
a.normalize();
See Also
normalized()
Quat coat::scripto::Quat::normalizeCopy ( ) const
inline
See Also
normalize()
Quat& coat::scripto::Quat::slerp ( const Quat b,
float  s 
)
inline

Interpolates between vectors, using spherical linear interpolation.

Quat a( 45, 70, 80 );
a.slerp( Quat( 100 ), 0.3 );
See Also
lerp()
Quat coat::scripto::Quat::slerpCopy ( const Quat b,
float  s 
) const
inline
See Also
slerp()