Options
All
• Public
• Public/Protected
• All

# Class Quaternion

The class to maniplate quaternion. Basically,you don't need to operate raw element. You consider to use some of useful methods without editing raw element forcelly. Each element will be represented as (w;x,y,z) (1,i,j,k) is base axis for quaternion. (i,j,k is pure imaginary number) (w;x,y,z) means w1+xi+yj+zk

• Quaternion

## Constructors

### constructor

• Constructor by specifing each elements.

## Properties

### rawElements

rawElements: IArray

## Accessors

### Conjugate

• Get the conjugate of this quaternion

### ImaginaryPart

• Getter for imaginary part vector. It returns the vector (x,y,z)

### Length

• get Length(): number

### W

• get W(): number

### X

• get X(): number

### Y

• get Y(): number

### Z

• get Z(): number

## Methods

### factoringQuaternionXYZ

• factoringQuaternionXYZ(): object

### factoringQuaternionZXY

• factoringQuaternionZXY(): object

### normalize

• Get normalized quaternion

### toAngleAxisString

• toAngleAxisString(): string

### toString

• toString(): string

• Calculate add result of two quaternion

### Static angle

• Returns the angle in degrees between two rotations q1 and q2.

#### Parameters

• ##### q1: Quaternion

the quaternion represents begin angle.

• ##### q2: Quaternion

the quaternion represents end angle.

### Static angleAxis

• Calculate the rotation quaternion represented as pair of angle and axis.

### Static euler

• euler(x: number, y: number, z: number): Quaternion

### Static eulerXYZ

• eulerXYZ(x: number, y: number, z: number): Quaternion

### Static fromToRotation

• Returns a quaternion that transform provided 'from' vector into 'to' vector. If 'from' cross 'to' is closer to 0 vector, axisHint is used as axis. This may only used for the situation when from vector and to vector is in relations these are negating the other.

#### Parameters

• ##### Default value axisHint: Vector3 = null

if no vector specified to this argument, [0,1,0] will be used for default

### Static multiply

• Calculate multiply result of two quaternion

### Static parse

• Parse angle string in 3D. "p" means Pi. Ex) 3/4 p "d" means degree. if this unit was specified, the argument will be parsed as degree. Ex) 90d "eular(x,y,z)" means rotation in eular. This means Z-X-Y rotation like Unity. "axis(angle,x,y,z)" means rotation around specified axis. This means angle radians will be rotated around the axis (x,y,z). This angle can be specified with the character "p" or "d". "x(angle)","y(angle)" or "z(angle)" means rotation around unit axis. This angle can be specified with the character "p" or "d".

#### Parameters

• ##### input: string

the string to be parsed as angle in 3D.

#### Returns Quaternion

parsed rotation in Quaternion.

### Static slerp

#### Returns Quaternion

Generated using TypeDoc