3DCoat  3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
coat::scripto::Quat Class Reference

Class for working with quaternions. More...

#include <SQuat.h>

Public Member Functions

 Quat ()
 Constructor for building a zero quaternion. More...
 
 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. More...
 
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...
 
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`

Constructor & Destructor Documentation

coat::scripto::Quat::Quat ( )
inline

Constructor for building a zero quaternion.

Referenced by expCopy(), invertCopy(), lnCopy(), and operator-().

Member Function Documentation

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();

References conjugateCopy().

Quat coat::scripto::Quat::conjugateCopy ( ) const
inline
See Also
conjugate()

Referenced by conjugate().

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 );
Quat& coat::scripto::Quat::exp ( )
inline

Calculates an exponential.

Quat a( 5, 2, 1, 0 );
a.exp();

References expCopy().

Quat coat::scripto::Quat::expCopy ( ) const
inline
See Also
exp()

References Quat().

Referenced by exp().

Quat& coat::scripto::Quat::invert ( )
inline

Inverts the quaternion.

Quat a( 5, 2, 1, 0 );
a.invert();

References invertCopy().

Quat coat::scripto::Quat::invertCopy ( ) const
inline
See Also
invert()

References Quat().

Referenced by invert().

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::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()

References lerpCopy().

Quat coat::scripto::Quat::lerpCopy ( const Quat b,
float  s 
) const
inline
See Also
lerp()

Referenced by lerp().

Quat& coat::scripto::Quat::ln ( )
inline

Calculates a natural logarithm.

Quat a( 5, 2, 1, 0 );
a.ln();

References lnCopy().

Quat coat::scripto::Quat::lnCopy ( ) const
inline
See Also
ln()

References Quat().

Referenced by 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()
bool coat::scripto::Quat::normalized ( ) const
inline

Returns TRUE then the quaternion is normalized.

See Also
normalized()
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 );
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::operator- ( ) const
inline

Negation operator.

Quat a( 5, 2, 1, 0 );
Quat na = -a;
See Also
Result.

References Quat().

bool coat::scripto::Quat::operator== ( const Quat b) const
inline

Comparison.

Quat a;
...
if (a == Quat( 5, 2, 1, 0 )) { ... }
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()

References slerpCopy().

Quat coat::scripto::Quat::slerpCopy ( const Quat b,
float  s 
) const
inline
See Also
slerp()

Referenced by slerp().

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::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()
bool coat::scripto::Quat::zero ( ) const
inline

Returns TRUE then the all values of the quaternion is zero.


The documentation for this class was generated from the following files: