From 342403a02f8063903d0f38327430721d4d0ae331 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 20 Sep 2021 18:15:14 -0500 Subject: do ass1 --- .../docs/html/classmingfx_1_1_quaternion.html | 1636 ++++++++++---------- 1 file changed, 818 insertions(+), 818 deletions(-) (limited to 'dev/MinGfx/docs/html/classmingfx_1_1_quaternion.html') diff --git a/dev/MinGfx/docs/html/classmingfx_1_1_quaternion.html b/dev/MinGfx/docs/html/classmingfx_1_1_quaternion.html index 3bce21e..09568d9 100644 --- a/dev/MinGfx/docs/html/classmingfx_1_1_quaternion.html +++ b/dev/MinGfx/docs/html/classmingfx_1_1_quaternion.html @@ -1,818 +1,818 @@ - - - - - - - -MinGfx Toolkit: mingfx::Quaternion Class Reference - - - - - - - - - - - - -
-
- - - - - - -
-
MinGfx Toolkit -  1.0 -
-
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
-
mingfx::Quaternion Class Reference
-
-
-

Detailed Description

-

A quaternion to represent rotations in 3D space.

-

The main use of quaternions within the library is to support smooth interpolation between rotations, since this is not possible using Euler angles or rotation matrices. The class includes a Slerp routine for spherical interpolation between rotations. Example use:

// find a rotation 1/2 way between r1 and r2, both originally expressed in Euler angles
-
-
Vector3 euler1 = GfxMath::ToRadians(Vector3(0,0,60));
-
Vector3 euler2 = GfxMath::ToRadians(Vector3(45,45,60));
-
- - -
-
float alpha = 0.5;
-
Quaternion q_half_way = q1.Slerp(q2, alpha);
-
Vector3 new_euler_angles = GfxMath::ToDegrees(q_half_way.ToEulerAnglesZYX());
-
static float ToRadians(float degrees)
-
static float ToDegrees(float radians)
-
static Quaternion FromEulerAnglesZYX(const Vector3 &angles)
Creates a new quaternion from a rotation defined in Euler angles.
-
Quaternion()
Creates a quat with the identity rotation.
-
-

Definition at line 41 of file quaternion.h.

-
-

#include <quaternion.h>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 Quaternion ()
 Creates a quat with the identity rotation. More...
 
 Quaternion (float qx, float qy, float qz, float qw)
 Creates a quat from the 4 parameters. More...
 
 Quaternion (float *ptr)
 Creates a quate from a pointer to 4 floating point numbers in the order qx, qy, qz, qw. More...
 
 Quaternion (const Quaternion &other)
 Copy constructor. More...
 
virtual ~Quaternion ()
 
bool operator== (const Quaternion &q) const
 Check for "equality", taking floating point imprecision into account. More...
 
bool operator!= (const Quaternion &q) const
 Check for "inequality", taking floating point imprecision into account. More...
 
Quaternionoperator= (const Quaternion &q)
 Assignment operator. More...
 
float operator[] (const int i) const
 Read only access to the ith coordinate of the quaternion (qx, qy, qz, qw). More...
 
float & operator[] (const int i)
 Writable access the ith coordinate of the quaternion (qx, qy, qz, qw). More...
 
float x () const
 Read only access to the x coordinate of the imaginary part of the quaternion. More...
 
float y () const
 Read only access to the y coordinate of the imaginary part of the quaternion. More...
 
float z () const
 Read only access to the z coordinate of the imaginary part of the quaternion. More...
 
float w () const
 Read only access to the w, real part, of the quaternion. More...
 
const float * value_ptr () const
 Returns a const pointer to the raw data array, stored in the order qx, qy, qz, qw. More...
 
float Dot (const Quaternion &q) const
 Returns the dot product of this quaternion with another. More...
 
float Length () const
 Returns the length of the quaternion. More...
 
void Normalize ()
 Normalizes the quat by making it unit length. More...
 
Quaternion ToUnit () const
 Returns a normalized (i.e., unit length) version of the quaternion without modifying the original. More...
 
Quaternion Conjugate () const
 Returns the conjugate of the quaternion. More...
 
Vector3 ToEulerAnglesZYX () const
 Converts the rotation specified by the quaternion into Euler angles. More...
 
Quaternion Slerp (const Quaternion &other, float alpha) const
 Uses spherical interpolation to interpoloate between the rotation stored in this quaternion and the rotation stored in another. More...
 
- - - - - - - - - - -

-Static Public Member Functions

static Quaternion FromAxisAngle (const Vector3 &axis, float angle)
 Creates a new quaternion that describes a rotation by angle radians about. More...
 
static Quaternion FromEulerAnglesZYX (const Vector3 &angles)
 Creates a new quaternion from a rotation defined in Euler angles. More...
 
static Quaternion Slerp (const Quaternion &a, const Quaternion &b, float alpha)
 Uses spherical interpolation to interpoloate between the rotations specified by two quaternions. More...
 
-

Constructor & Destructor Documentation

- -

◆ Quaternion() [1/4]

- -
-
- - - - - - - -
mingfx::Quaternion::Quaternion ()
-
- -

Creates a quat with the identity rotation.

- -
-
- -

◆ Quaternion() [2/4]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mingfx::Quaternion::Quaternion (float qx,
float qy,
float qz,
float qw 
)
-
- -

Creates a quat from the 4 parameters.

- -
-
- -

◆ Quaternion() [3/4]

- -
-
- - - - - - - - -
mingfx::Quaternion::Quaternion (float * ptr)
-
- -

Creates a quate from a pointer to 4 floating point numbers in the order qx, qy, qz, qw.

- -
-
- -

◆ Quaternion() [4/4]

- -
-
- - - - - - - - -
mingfx::Quaternion::Quaternion (const Quaternionother)
-
- -

Copy constructor.

- -
-
- -

◆ ~Quaternion()

- -
-
- - - - - -
- - - - - - - -
virtual mingfx::Quaternion::~Quaternion ()
-
-virtual
-
- -
-
-

Member Function Documentation

- -

◆ Conjugate()

- -
-
- - - - - - - -
Quaternion mingfx::Quaternion::Conjugate () const
-
- -

Returns the conjugate of the quaternion.

- -
-
- -

◆ Dot()

- -
-
- - - - - - - - -
float mingfx::Quaternion::Dot (const Quaternionq) const
-
- -

Returns the dot product of this quaternion with another.

- -
-
- -

◆ FromAxisAngle()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
static Quaternion mingfx::Quaternion::FromAxisAngle (const Vector3axis,
float angle 
)
-
-static
-
- -

Creates a new quaternion that describes a rotation by angle radians about.

- -
-
- -

◆ FromEulerAnglesZYX()

- -
-
- - - - - -
- - - - - - - - -
static Quaternion mingfx::Quaternion::FromEulerAnglesZYX (const Vector3angles)
-
-static
-
- -

Creates a new quaternion from a rotation defined in Euler angles.

- -
-
- -

◆ Length()

- -
-
- - - - - - - -
float mingfx::Quaternion::Length () const
-
- -

Returns the length of the quaternion.

- -
-
- -

◆ Normalize()

- -
-
- - - - - - - -
void mingfx::Quaternion::Normalize ()
-
- -

Normalizes the quat by making it unit length.

- -
-
- -

◆ operator!=()

- -
-
- - - - - - - - -
bool mingfx::Quaternion::operator!= (const Quaternionq) const
-
- -

Check for "inequality", taking floating point imprecision into account.

- -
-
- -

◆ operator=()

- -
-
- - - - - - - - -
Quaternion& mingfx::Quaternion::operator= (const Quaternionq)
-
- -

Assignment operator.

- -
-
- -

◆ operator==()

- -
-
- - - - - - - - -
bool mingfx::Quaternion::operator== (const Quaternionq) const
-
- -

Check for "equality", taking floating point imprecision into account.

- -
-
- -

◆ operator[]() [1/2]

- -
-
- - - - - - - - -
float& mingfx::Quaternion::operator[] (const int i)
-
- -

Writable access the ith coordinate of the quaternion (qx, qy, qz, qw).

- -
-
- -

◆ operator[]() [2/2]

- -
-
- - - - - - - - -
float mingfx::Quaternion::operator[] (const int i) const
-
- -

Read only access to the ith coordinate of the quaternion (qx, qy, qz, qw).

- -
-
- -

◆ Slerp() [1/2]

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
static Quaternion mingfx::Quaternion::Slerp (const Quaterniona,
const Quaternionb,
float alpha 
)
-
-static
-
- -

Uses spherical interpolation to interpoloate between the rotations specified by two quaternions.

- -
-
- -

◆ Slerp() [2/2]

- -
-
- - - - - - - - - - - - - - - - - - -
Quaternion mingfx::Quaternion::Slerp (const Quaternionother,
float alpha 
) const
-
- -

Uses spherical interpolation to interpoloate between the rotation stored in this quaternion and the rotation stored in another.

- -
-
- -

◆ ToEulerAnglesZYX()

- -
-
- - - - - - - -
Vector3 mingfx::Quaternion::ToEulerAnglesZYX () const
-
- -

Converts the rotation specified by the quaternion into Euler angles.

- -
-
- -

◆ ToUnit()

- -
-
- - - - - - - -
Quaternion mingfx::Quaternion::ToUnit () const
-
- -

Returns a normalized (i.e., unit length) version of the quaternion without modifying the original.

- -
-
- -

◆ value_ptr()

- -
-
- - - - - - - -
const float* mingfx::Quaternion::value_ptr () const
-
- -

Returns a const pointer to the raw data array, stored in the order qx, qy, qz, qw.

- -
-
- -

◆ w()

- -
-
- - - - - -
- - - - - - - -
float mingfx::Quaternion::w () const
-
-inline
-
- -

Read only access to the w, real part, of the quaternion.

- -

Definition at line 83 of file quaternion.h.

- -
-
- -

◆ x()

- -
-
- - - - - -
- - - - - - - -
float mingfx::Quaternion::x () const
-
-inline
-
- -

Read only access to the x coordinate of the imaginary part of the quaternion.

- -

Definition at line 74 of file quaternion.h.

- -
-
- -

◆ y()

- -
-
- - - - - -
- - - - - - - -
float mingfx::Quaternion::y () const
-
-inline
-
- -

Read only access to the y coordinate of the imaginary part of the quaternion.

- -

Definition at line 77 of file quaternion.h.

- -
-
- -

◆ z()

- -
-
- - - - - -
- - - - - - - -
float mingfx::Quaternion::z () const
-
-inline
-
- -

Read only access to the z coordinate of the imaginary part of the quaternion.

- -

Definition at line 80 of file quaternion.h.

- -
-
-
The documentation for this class was generated from the following file: -
- - - - - + + + + + + + +MinGfx Toolkit: mingfx::Quaternion Class Reference + + + + + + + + + + + + +
+
+ + + + + + +
+
MinGfx Toolkit +  1.0 +
+
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
mingfx::Quaternion Class Reference
+
+
+

Detailed Description

+

A quaternion to represent rotations in 3D space.

+

The main use of quaternions within the library is to support smooth interpolation between rotations, since this is not possible using Euler angles or rotation matrices. The class includes a Slerp routine for spherical interpolation between rotations. Example use:

// find a rotation 1/2 way between r1 and r2, both originally expressed in Euler angles
+
+
Vector3 euler1 = GfxMath::ToRadians(Vector3(0,0,60));
+
Vector3 euler2 = GfxMath::ToRadians(Vector3(45,45,60));
+
+ + +
+
float alpha = 0.5;
+
Quaternion q_half_way = q1.Slerp(q2, alpha);
+
Vector3 new_euler_angles = GfxMath::ToDegrees(q_half_way.ToEulerAnglesZYX());
+
static float ToRadians(float degrees)
+
static float ToDegrees(float radians)
+
static Quaternion FromEulerAnglesZYX(const Vector3 &angles)
Creates a new quaternion from a rotation defined in Euler angles.
+
Quaternion()
Creates a quat with the identity rotation.
+
+

Definition at line 41 of file quaternion.h.

+
+

#include <quaternion.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Quaternion ()
 Creates a quat with the identity rotation. More...
 
 Quaternion (float qx, float qy, float qz, float qw)
 Creates a quat from the 4 parameters. More...
 
 Quaternion (float *ptr)
 Creates a quate from a pointer to 4 floating point numbers in the order qx, qy, qz, qw. More...
 
 Quaternion (const Quaternion &other)
 Copy constructor. More...
 
virtual ~Quaternion ()
 
bool operator== (const Quaternion &q) const
 Check for "equality", taking floating point imprecision into account. More...
 
bool operator!= (const Quaternion &q) const
 Check for "inequality", taking floating point imprecision into account. More...
 
Quaternionoperator= (const Quaternion &q)
 Assignment operator. More...
 
float operator[] (const int i) const
 Read only access to the ith coordinate of the quaternion (qx, qy, qz, qw). More...
 
float & operator[] (const int i)
 Writable access the ith coordinate of the quaternion (qx, qy, qz, qw). More...
 
float x () const
 Read only access to the x coordinate of the imaginary part of the quaternion. More...
 
float y () const
 Read only access to the y coordinate of the imaginary part of the quaternion. More...
 
float z () const
 Read only access to the z coordinate of the imaginary part of the quaternion. More...
 
float w () const
 Read only access to the w, real part, of the quaternion. More...
 
const float * value_ptr () const
 Returns a const pointer to the raw data array, stored in the order qx, qy, qz, qw. More...
 
float Dot (const Quaternion &q) const
 Returns the dot product of this quaternion with another. More...
 
float Length () const
 Returns the length of the quaternion. More...
 
void Normalize ()
 Normalizes the quat by making it unit length. More...
 
Quaternion ToUnit () const
 Returns a normalized (i.e., unit length) version of the quaternion without modifying the original. More...
 
Quaternion Conjugate () const
 Returns the conjugate of the quaternion. More...
 
Vector3 ToEulerAnglesZYX () const
 Converts the rotation specified by the quaternion into Euler angles. More...
 
Quaternion Slerp (const Quaternion &other, float alpha) const
 Uses spherical interpolation to interpoloate between the rotation stored in this quaternion and the rotation stored in another. More...
 
+ + + + + + + + + + +

+Static Public Member Functions

static Quaternion FromAxisAngle (const Vector3 &axis, float angle)
 Creates a new quaternion that describes a rotation by angle radians about. More...
 
static Quaternion FromEulerAnglesZYX (const Vector3 &angles)
 Creates a new quaternion from a rotation defined in Euler angles. More...
 
static Quaternion Slerp (const Quaternion &a, const Quaternion &b, float alpha)
 Uses spherical interpolation to interpoloate between the rotations specified by two quaternions. More...
 
+

Constructor & Destructor Documentation

+ +

◆ Quaternion() [1/4]

+ +
+
+ + + + + + + +
mingfx::Quaternion::Quaternion ()
+
+ +

Creates a quat with the identity rotation.

+ +
+
+ +

◆ Quaternion() [2/4]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mingfx::Quaternion::Quaternion (float qx,
float qy,
float qz,
float qw 
)
+
+ +

Creates a quat from the 4 parameters.

+ +
+
+ +

◆ Quaternion() [3/4]

+ +
+
+ + + + + + + + +
mingfx::Quaternion::Quaternion (float * ptr)
+
+ +

Creates a quate from a pointer to 4 floating point numbers in the order qx, qy, qz, qw.

+ +
+
+ +

◆ Quaternion() [4/4]

+ +
+
+ + + + + + + + +
mingfx::Quaternion::Quaternion (const Quaternionother)
+
+ +

Copy constructor.

+ +
+
+ +

◆ ~Quaternion()

+ +
+
+ + + + + +
+ + + + + + + +
virtual mingfx::Quaternion::~Quaternion ()
+
+virtual
+
+ +
+
+

Member Function Documentation

+ +

◆ Conjugate()

+ +
+
+ + + + + + + +
Quaternion mingfx::Quaternion::Conjugate () const
+
+ +

Returns the conjugate of the quaternion.

+ +
+
+ +

◆ Dot()

+ +
+
+ + + + + + + + +
float mingfx::Quaternion::Dot (const Quaternionq) const
+
+ +

Returns the dot product of this quaternion with another.

+ +
+
+ +

◆ FromAxisAngle()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static Quaternion mingfx::Quaternion::FromAxisAngle (const Vector3axis,
float angle 
)
+
+static
+
+ +

Creates a new quaternion that describes a rotation by angle radians about.

+ +
+
+ +

◆ FromEulerAnglesZYX()

+ +
+
+ + + + + +
+ + + + + + + + +
static Quaternion mingfx::Quaternion::FromEulerAnglesZYX (const Vector3angles)
+
+static
+
+ +

Creates a new quaternion from a rotation defined in Euler angles.

+ +
+
+ +

◆ Length()

+ +
+
+ + + + + + + +
float mingfx::Quaternion::Length () const
+
+ +

Returns the length of the quaternion.

+ +
+
+ +

◆ Normalize()

+ +
+
+ + + + + + + +
void mingfx::Quaternion::Normalize ()
+
+ +

Normalizes the quat by making it unit length.

+ +
+
+ +

◆ operator!=()

+ +
+
+ + + + + + + + +
bool mingfx::Quaternion::operator!= (const Quaternionq) const
+
+ +

Check for "inequality", taking floating point imprecision into account.

+ +
+
+ +

◆ operator=()

+ +
+
+ + + + + + + + +
Quaternion& mingfx::Quaternion::operator= (const Quaternionq)
+
+ +

Assignment operator.

+ +
+
+ +

◆ operator==()

+ +
+
+ + + + + + + + +
bool mingfx::Quaternion::operator== (const Quaternionq) const
+
+ +

Check for "equality", taking floating point imprecision into account.

+ +
+
+ +

◆ operator[]() [1/2]

+ +
+
+ + + + + + + + +
float& mingfx::Quaternion::operator[] (const int i)
+
+ +

Writable access the ith coordinate of the quaternion (qx, qy, qz, qw).

+ +
+
+ +

◆ operator[]() [2/2]

+ +
+
+ + + + + + + + +
float mingfx::Quaternion::operator[] (const int i) const
+
+ +

Read only access to the ith coordinate of the quaternion (qx, qy, qz, qw).

+ +
+
+ +

◆ Slerp() [1/2]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Quaternion mingfx::Quaternion::Slerp (const Quaterniona,
const Quaternionb,
float alpha 
)
+
+static
+
+ +

Uses spherical interpolation to interpoloate between the rotations specified by two quaternions.

+ +
+
+ +

◆ Slerp() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + +
Quaternion mingfx::Quaternion::Slerp (const Quaternionother,
float alpha 
) const
+
+ +

Uses spherical interpolation to interpoloate between the rotation stored in this quaternion and the rotation stored in another.

+ +
+
+ +

◆ ToEulerAnglesZYX()

+ +
+
+ + + + + + + +
Vector3 mingfx::Quaternion::ToEulerAnglesZYX () const
+
+ +

Converts the rotation specified by the quaternion into Euler angles.

+ +
+
+ +

◆ ToUnit()

+ +
+
+ + + + + + + +
Quaternion mingfx::Quaternion::ToUnit () const
+
+ +

Returns a normalized (i.e., unit length) version of the quaternion without modifying the original.

+ +
+
+ +

◆ value_ptr()

+ +
+
+ + + + + + + +
const float* mingfx::Quaternion::value_ptr () const
+
+ +

Returns a const pointer to the raw data array, stored in the order qx, qy, qz, qw.

+ +
+
+ +

◆ w()

+ +
+
+ + + + + +
+ + + + + + + +
float mingfx::Quaternion::w () const
+
+inline
+
+ +

Read only access to the w, real part, of the quaternion.

+ +

Definition at line 83 of file quaternion.h.

+ +
+
+ +

◆ x()

+ +
+
+ + + + + +
+ + + + + + + +
float mingfx::Quaternion::x () const
+
+inline
+
+ +

Read only access to the x coordinate of the imaginary part of the quaternion.

+ +

Definition at line 74 of file quaternion.h.

+ +
+
+ +

◆ y()

+ +
+
+ + + + + +
+ + + + + + + +
float mingfx::Quaternion::y () const
+
+inline
+
+ +

Read only access to the y coordinate of the imaginary part of the quaternion.

+ +

Definition at line 77 of file quaternion.h.

+ +
+
+ +

◆ z()

+ +
+
+ + + + + +
+ + + + + + + +
float mingfx::Quaternion::z () const
+
+inline
+
+ +

Read only access to the z coordinate of the imaginary part of the quaternion.

+ +

Definition at line 80 of file quaternion.h.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + + -- cgit v1.2.3