# Class: Fox::FXQuatf

Inherits:
FXVec4f
show all
Defined in:
rdoc-sources/FXQuatf.rb

#w, #x, #y, #z

## Instance Method Summary collapse

• Compute the rotation of a vector vec by this quaternion; returns the rotated vector (a new FXVec3f instance).

• Adjust quaternion length; returns a reference to self.

• Construct a quaternion from arc a->b on unit sphere and return reference to self.

• Return the conjugate of this quaternion (a new FXQuatf instance).

• Return the exponentiation of this quaternion (a new FXQuatf instance).

• Get quaternion axes as a 3-element array of FXVec3f instances.

• Return the rotation axis and angle for this quaternion, i.e.

• Obtain roll, pitch and yaw angles (in radians) from quaternion, e.g.

• Return the local x-axis as an FXVec3f instance.

• Return the local y-axis as an FXVec3f instance.

• Return the local z-axis as an FXVec3f instance.

• constructor

Construct an FXQuatf from components.

• Return the inverse of this quaternion (a new FXQuatf instance).

• Spherical lerp, return reference to self.

• Return the logarithm of this quaternion (a new FXQuatf instance).

• Set quaternion from axes (where ex, ey and ez are FXVec3f instances).

• Set quaternion from rotation axis and angle.

• Set quaternion from yaw (z), pitch (y) and roll (x).

• Invert unit quaternion (returns a new FXQuatf instance).

## Constructor Details

### #initialize(x, y, z, w) ⇒ FXQuatf

Construct an FXQuatf from components.

#### Parameters:

`x`

x [Float]

`y`

y [Float]

`z`

z [Float]

`width`

w [Float]

 ``` 4``` ```# File 'rdoc-sources/FXQuatf.rb', line 4 def initialize; end```

## Instance Method Details

### #*(vec) ⇒ Object

Compute the rotation of a vector vec by this quaternion; returns the rotated vector (a new FXVec3f instance).

#### Parameters:

`vec`

the vector to be rotated Fox::FXVec3f

 ``` 139``` ```# File 'rdoc-sources/FXQuatf.rb', line 139 def *(other); end```

Adjust quaternion length; returns a reference to self.

 ``` 56``` ```# File 'rdoc-sources/FXQuatf.rb', line 56 def adjust!; end```

### #arc!(a, b) ⇒ Object

Construct a quaternion from arc a->b on unit sphere and return reference to self.

#### Parameters:

`a`

Fox::FXVec3f

`b`

Fox::FXVec3f

 ``` 160``` ```# File 'rdoc-sources/FXQuatf.rb', line 160 def arc!(a, b); end```

### #conj ⇒ Object

Return the conjugate of this quaternion (a new FXQuatf instance).

 ``` 134``` ```# File 'rdoc-sources/FXQuatf.rb', line 134 def conj; end```

### #exp ⇒ Object

Return the exponentiation of this quaternion (a new FXQuatf instance).

 ``` 114``` ```# File 'rdoc-sources/FXQuatf.rb', line 114 def exp; end```

### #getAxes ⇒ Object

Get quaternion axes as a 3-element array of FXVec3f instances.

 ``` 100``` ```# File 'rdoc-sources/FXQuatf.rb', line 100 def getAxes(); end```

### #getAxisAngle ⇒ Object

Return the rotation axis and angle for this quaternion, i.e.

``````axis, angle = aQuaternion.getAxisAngle()
``````

where axis is an FXVec3f instance and angle is the angle of rotation in radians.

 ``` 76``` ```# File 'rdoc-sources/FXQuatf.rb', line 76 def getAxisAngle(); end```

### #getRollPitchYaw ⇒ Object

Obtain roll, pitch and yaw angles (in radians) from quaternion, e.g.

``````roll, pitch, yaw = aQuaternion.getRollPitchYaw()
``````
 ``` 94``` ```# File 'rdoc-sources/FXQuatf.rb', line 94 def getRollPitchYaw(); end```

### #getXAxis ⇒ Object

Return the local x-axis as an FXVec3f instance.

 ``` 103``` ```# File 'rdoc-sources/FXQuatf.rb', line 103 def getXAxis(); end```

### #getYAxis ⇒ Object

Return the local y-axis as an FXVec3f instance.

 ``` 106``` ```# File 'rdoc-sources/FXQuatf.rb', line 106 def getYAxis(); end```

### #getZAxis ⇒ Object

Return the local z-axis as an FXVec3f instance.

 ``` 109``` ```# File 'rdoc-sources/FXQuatf.rb', line 109 def getZAxis(); end```

### #invert ⇒ Object

Return the inverse of this quaternion (a new FXQuatf instance).

 ``` 124``` ```# File 'rdoc-sources/FXQuatf.rb', line 124 def invert; end```

### #lerp!(u, v, f) ⇒ Object

Spherical lerp, return reference to self.

#### Parameters:

`u`

Fox::FXQuatf

`v`

Fox::FXQuatf

`f`
Float
 ``` 171``` ```# File 'rdoc-sources/FXQuatf.rb', line 171 def lerp!(u, v, f); end```

### #log ⇒ Object

Return the logarithm of this quaternion (a new FXQuatf instance).

 ``` 119``` ```# File 'rdoc-sources/FXQuatf.rb', line 119 def log; end```

### #setAxes(ex, ey, ez) ⇒ Object

Set quaternion from axes (where ex, ey and ez are FXVec3f instances).

 ``` 97``` ```# File 'rdoc-sources/FXQuatf.rb', line 97 def setAxes(ex, ey, ez); end```

### #setAxisAngle(axis, phi = 0.0) ⇒ Object

Set quaternion from rotation axis and angle.

#### Parameters:

`axis`

the rotation axis Fox::FXVec3f

`angle`

the rotation angle (in radians) [Float]

 ``` 66``` ```# File 'rdoc-sources/FXQuatf.rb', line 66 def setAxisAngle(axis, phi=0.0); end```

### #setRollPitchYaw(roll, pitch, yaw) ⇒ Object

Set quaternion from yaw (z), pitch (y) and roll (x).

#### Parameters:

`roll`

`pitch`

`yaw`
 ``` 87``` ```# File 'rdoc-sources/FXQuatf.rb', line 87 def setRollPitchYaw(roll, pitch, yaw); end```
 ``` 129``` ```# File 'rdoc-sources/FXQuatf.rb', line 129 def unitinvert; end```