Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.Quaternion Class Reference

Immutable 4-component quaternion. More...

Inheritance diagram for Dragengine.Scenery.Quaternion:

Public Member Functions

Management
float getX ()
 X-Component. More...
 
float getY ()
 Y-Component. More...
 
float getZ ()
 Z-Component. More...
 
float getW ()
 W-Component. More...
 
float get (int component)
 Component by index (0=X, 1=Y, 2=Z, 3=W). More...
 
float getLength ()
 Length. More...
 
Quaternion normalize ()
 Quaternion divided by length(). More...
 
Quaternion conjugate ()
 Conjugated quaternion. More...
 
Quaternion absolute ()
 Absolute quaternion. More...
 
Vector getEulerAngles ()
 Euler angles matching quaternion rotation. More...
 
Quaternion slerp (Quaternion other, float factor)
 Slerp quaternion with another quaternion. More...
 
bool isEqualTo (Quaternion q, float threshold)
 Two quaternions are equal. More...
 
bool equals (Object other)
 Quaternion is equal to another object. More...
 
int hashCode ()
 Hash code for use as dictionary keys. More...
 
String toString ()
 String representation of quaternion. More...
 
String toString (int precision)
 String representation of quaternion with precision. More...
 
Operators
Quaternion operator- ()
 Returns the negated of quaternion. More...
 
Quaternion operator+ (Quaternion quaternion)
 Returns the sum of quaternion with another Quaternion. More...
 
Quaternion operator- (Quaternion quaternion)
 Returns the difference of quaternion and another Quaternion. More...
 
Quaternion operator* (float scalar)
 Returns quaternion multiplied by a factor. More...
 
Quaternion operator/ (float scalar)
 Returns quaternion divided by a factor. More...
 
Quaternion operator* (Quaternion quaternion)
 Returns quaternion multiplication. More...
 
Vector operator* (Vector vector)
 Rotate vector by quaternion. More...
 
DVector operator* (DVector vector)
 Rotate vector by quaternion. More...
 

Constructors

Quaternion new ()
 Create quaternion with components set to (0,0,0,1). More...
 
Quaternion new (float x, float y, float z, float w)
 Create quaternion from values. More...
 
Quaternion new (Quaternion q)
 Create copy of quaternion. More...
 
static Quaternion newFromEuler (float rx, float ry, float rz)
 Create quaternion from euler angles. More...
 
static Quaternion newFromEuler (Vector angles)
 Create quaternion from euler angles. More...
 
static Quaternion newFromEulerX (float angle)
 Create quaternion from an euler angle around the x axis. More...
 
static Quaternion newFromEulerY (float angle)
 Create quaternion from an euler angle around the y axis. More...
 
static Quaternion newFromEulerZ (float angle)
 Create quaternion from an euler angle around the z axis. More...
 
static Quaternion newFromAxis (Vector axis, float angle)
 Create quaternion from axis and angle around the axis. More...
 

File Handling

void writeToFile (FileWriter writer)
 Write quaternion to a file writer. More...
 
static Quaternion readFromFile (FileReader reader)
 Read quaternion from a file reader. More...
 

Detailed Description

Immutable 4-component quaternion.

This is a native class. It can not be subclassed.

Member Function Documentation

◆ absolute()

Quaternion Dragengine.Scenery.Quaternion.absolute ( )

Absolute quaternion.

◆ conjugate()

Quaternion Dragengine.Scenery.Quaternion.conjugate ( )

Conjugated quaternion.

◆ equals()

bool Dragengine.Scenery.Quaternion.equals ( Object  other)

Quaternion is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Quaternion and components are equal.

◆ get()

float Dragengine.Scenery.Quaternion.get ( int  component)

Component by index (0=X, 1=Y, 2=Z, 3=W).

◆ getEulerAngles()

Vector Dragengine.Scenery.Quaternion.getEulerAngles ( )

Euler angles matching quaternion rotation.

Result is only correct if the quaternion is normalized.

◆ getLength()

float Dragengine.Scenery.Quaternion.getLength ( )

Length.

◆ getW()

float Dragengine.Scenery.Quaternion.getW ( )

W-Component.

◆ getX()

float Dragengine.Scenery.Quaternion.getX ( )

X-Component.

◆ getY()

float Dragengine.Scenery.Quaternion.getY ( )

Y-Component.

◆ getZ()

float Dragengine.Scenery.Quaternion.getZ ( )

Z-Component.

◆ hashCode()

int Dragengine.Scenery.Quaternion.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ isEqualTo()

bool Dragengine.Scenery.Quaternion.isEqualTo ( Quaternion  q,
float  threshold 
)

Two quaternions are equal.

◆ new() [1/3]

Quaternion Dragengine.Scenery.Quaternion.new ( )

Create quaternion with components set to (0,0,0,1).

◆ new() [2/3]

Quaternion Dragengine.Scenery.Quaternion.new ( float  x,
float  y,
float  z,
float  w 
)

Create quaternion from values.

◆ new() [3/3]

Quaternion Dragengine.Scenery.Quaternion.new ( Quaternion  q)

Create copy of quaternion.

◆ newFromAxis()

static Quaternion Dragengine.Scenery.Quaternion.newFromAxis ( Vector  axis,
float  angle 
)
static

Create quaternion from axis and angle around the axis.

◆ newFromEuler() [1/2]

static Quaternion Dragengine.Scenery.Quaternion.newFromEuler ( float  rx,
float  ry,
float  rz 
)
static

Create quaternion from euler angles.

◆ newFromEuler() [2/2]

static Quaternion Dragengine.Scenery.Quaternion.newFromEuler ( Vector  angles)
static

Create quaternion from euler angles.

◆ newFromEulerX()

static Quaternion Dragengine.Scenery.Quaternion.newFromEulerX ( float  angle)
static

Create quaternion from an euler angle around the x axis.

◆ newFromEulerY()

static Quaternion Dragengine.Scenery.Quaternion.newFromEulerY ( float  angle)
static

Create quaternion from an euler angle around the y axis.

◆ newFromEulerZ()

static Quaternion Dragengine.Scenery.Quaternion.newFromEulerZ ( float  angle)
static

Create quaternion from an euler angle around the z axis.

◆ normalize()

Quaternion Dragengine.Scenery.Quaternion.normalize ( )

Quaternion divided by length().

Exceptions
EDivisionByZeroLength is 0.

◆ operator*() [1/4]

DVector Dragengine.Scenery.Quaternion.operator* ( DVector  vector)

Rotate vector by quaternion.

◆ operator*() [2/4]

Quaternion Dragengine.Scenery.Quaternion.operator* ( float  scalar)

Returns quaternion multiplied by a factor.

◆ operator*() [3/4]

Quaternion Dragengine.Scenery.Quaternion.operator* ( Quaternion  quaternion)

Returns quaternion multiplication.

If both quaternions are unit quaternions this operation equals applying the rotation of quaternion to the rotation of this quaternion.

◆ operator*() [4/4]

Vector Dragengine.Scenery.Quaternion.operator* ( Vector  vector)

Rotate vector by quaternion.

◆ operator+()

Quaternion Dragengine.Scenery.Quaternion.operator+ ( Quaternion  quaternion)

Returns the sum of quaternion with another Quaternion.

◆ operator-() [1/2]

Quaternion Dragengine.Scenery.Quaternion.operator- ( )

Returns the negated of quaternion.

◆ operator-() [2/2]

Quaternion Dragengine.Scenery.Quaternion.operator- ( Quaternion  quaternion)

Returns the difference of quaternion and another Quaternion.

◆ operator/()

Quaternion Dragengine.Scenery.Quaternion.operator/ ( float  scalar)

Returns quaternion divided by a factor.

Exceptions
EDivisionByZeroscalar is 0.

◆ readFromFile()

static Quaternion Dragengine.Scenery.Quaternion.readFromFile ( FileReader  reader)
static

Read quaternion from a file reader.

◆ slerp()

Quaternion Dragengine.Scenery.Quaternion.slerp ( Quaternion  other,
float  factor 
)

Slerp quaternion with another quaternion.

◆ toString() [1/2]

String Dragengine.Scenery.Quaternion.toString ( )

String representation of quaternion.

Implements Object.toString()

◆ toString() [2/2]

String Dragengine.Scenery.Quaternion.toString ( int  precision)

String representation of quaternion with precision.

Same as toString() except the count of digits of each component is precision.

Parameters
precisionPrecision in digits in the range from 0 to 9 inclusive.
Exceptions
EInvalidParamprecision is less than 0 or larger than 9.

◆ writeToFile()

void Dragengine.Scenery.Quaternion.writeToFile ( FileWriter  writer)

Write quaternion to a file writer.


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