Drag[en]gine Script Module DragonScript Script API  1.0
Quaternion Class Reference

Immutable 4-component quaternion. More...

Inheritance diagram for 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 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...
 
int hashCode ()
 Hash code for use as dictionary keys. More...
 
String toString ()
 String representation of quaternion. More...
 
Operators
Quaternion operator- ()
 Returns the negated of quaternion. More...
 
Quaternion operator+ (Quaternion q)
 Returns the sum of quaternion with another Quaternion. More...
 
Quaternion operator- (Quaternion q)
 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...
 

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...
 

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.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ absolute()

Quaternion absolute ( )

Absolute quaternion.

§ get()

float get ( int  component)

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

§ getEulerAngles()

Vector getEulerAngles ( )

Euler angles matching quaternion rotation.

Result is only correct if the quaternion is normalized.

§ getLength()

float getLength ( )

Length.

§ getW()

float getW ( )

W-Component.

§ getX()

float getX ( )

X-Component.

§ getY()

float getY ( )

Y-Component.

§ getZ()

float getZ ( )

Z-Component.

§ hashCode()

int hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

§ isEqualTo()

bool isEqualTo ( Quaternion  q,
float  threshold 
)

Two quaternions are equal.

§ new() [1/3]

Quaternion new ( )

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

§ new() [2/3]

Quaternion new ( float  x,
float  y,
float  z,
float  w 
)

Create quaternion from values.

§ new() [3/3]

Quaternion new ( Quaternion  q)

Create copy of quaternion.

§ newFromEuler() [1/2]

static Quaternion newFromEuler ( float  rx,
float  ry,
float  rz 
)
static

Create quaternion from euler angles.

§ newFromEuler() [2/2]

static Quaternion newFromEuler ( Vector  angles)
static

Create quaternion from euler angles.

§ newFromEulerX()

static Quaternion newFromEulerX ( float  angle)
static

Create quaternion from an euler angle around the x axis.

§ newFromEulerY()

static Quaternion newFromEulerY ( float  angle)
static

Create quaternion from an euler angle around the y axis.

§ newFromEulerZ()

static Quaternion newFromEulerZ ( float  angle)
static

Create quaternion from an euler angle around the z axis.

§ normalize()

Quaternion normalize ( )

Quaternion divided by length().

Exceptions
EDivisionByZeroLength is 0.

§ operator*()

Quaternion operator* ( float  scalar)

Returns quaternion multiplied by a factor.

§ operator+()

Quaternion operator+ ( Quaternion  q)

Returns the sum of quaternion with another Quaternion.

§ operator-() [1/2]

Quaternion operator- ( )

Returns the negated of quaternion.

§ operator-() [2/2]

Quaternion operator- ( Quaternion  q)

Returns the difference of quaternion and another Quaternion.

§ operator/()

Quaternion operator/ ( float  scalar)

Returns quaternion divided by a factor.

Exceptions
EDivisionByZeroscalar is 0.

§ readFromFile()

static Quaternion readFromFile ( FileReader  reader)
static

Read quaternion from a file reader.

§ slerp()

Quaternion slerp ( Quaternion  other,
float  factor 
)

Slerp quaternion with another quaternion.

§ toString()

String toString ( )

String representation of quaternion.

Implements Object.toString()

§ writeToFile()

void writeToFile ( FileWriter  writer)

Write quaternion to a file writer.


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