EngineKit
Rotation Class Reference

#import <Rotation.h>

Inheritance diagram for Rotation:
<RotationExport>

Instance Methods

(instancetype) - initWithSCNVector4:
 
(instancetype) - initWithAxis:angle:
 
(instancetype) - initWithArray:
 
(instancetype) - initWithObject:
 
(SCNVector4) - toSCNVector
 

Class Methods

(instancetype) + rotationWithAxis:angle:
 
(instancetype) + rotationWithArray:
 
(instancetype) + rotationWithObject:
 
(instancetype) + rotationWithSCNVector4:
 

Detailed Description

Represents a rotation of a determined angle around a determined axis.

Method Documentation

- (instancetype) initWithArray: (NSArray *)  array

Creates a Rotation based on the given NSArray. Trusts that the array has enough (4 or more) components, and that the first 4 components may be cast into NSNumbers.

The first 3 numbers are used to create an Axis, and the fourth represents the angle for the rotation. This is much like the SCNVector4s are used for rotation.

Parameters
arrayThe array representing the rotation.
Returns
An initialized Rotation object.
- (instancetype) initWithAxis: (Axis *)  axis
angle: (Angle *)  angle 

Creates a Rotation of angle radians around the given axis.

Parameters
axisThe Axis around which to rotate.
angleThe Angle by which to rotate.
Returns
An initialized Rotation object.
- (instancetype) initWithObject: (id)  object

Creates a Rotation based on the given object. The supported objects are:

  • NSArray, which will be initialized just like -initWithArray.
  • NSValue containing a SCNVector4, which will be initialized just like -initWithSCNVector4.
Warning
In case the object isn't a subclass of any of the above classes, an assert(false) will be triggered.
Parameters
objectAn object of any one of the classes mentioned above.
Returns
An initialized Rotation object.
See also
-initWithArray
-initWithSCNVector4
- (instancetype) initWithSCNVector4: (SCNVector4)  vector

Creates a Rotation in which all components are set as just as the given SCNVector4. This initialization is a lot like -initWithArray.

Parameters
vectorThe SCNVector4 that should be used as a model.
Returns
An initialized Rotation object.
See also
-initWithArray
+ (instancetype) rotationWithArray: (NSArray *)  array

Creates a Rotation based on the given NSArray. Trusts that the array has enough (4 or more) components, and that the first 4 components may be cast into NSNumbers.

The first 3 numbers are used to create an Axis, and the fourth represents the angle for the rotation. This is much like the SCNVector4s are used for rotation.

Parameters
arrayThe array representing the rotation.
Returns
An initialized Rotation object.
+ (instancetype) rotationWithAxis: (Axis *)  axis
angle: (Angle *)  angle 

Creates a Rotation of angle radians around the given axis.

Parameters
axisThe Axis around which to rotate.
angleThe Angle by which to rotate.
Returns
An initialized Rotation object.
+ (instancetype) rotationWithObject: (id)  object

Creates a Rotation based on the given object. The supported objects are:

  • NSArray, which will be initialized just like -initWithArray.
  • NSValue containing a SCNVector4, which will be initialized just like -initWithSCNVector4.
Warning
In case the object isn't a subclass of any of the above classes, an assert(false) will be triggered.
Parameters
objectAn object of any one of the classes mentioned above.
Returns
An initialized Rotation object.
See also
-initWithArray
-initWithSCNVector4
+ (instancetype) rotationWithSCNVector4: (SCNVector4)  vector

Creates a Rotation in which all components are set as just as the given SCNVector4. This initialization is a lot like -initWithArray.

Parameters
vectorThe SCNVector4 that should be used as a model.
Returns
An initialized Rotation object.
See also
-initWithArray
- (SCNVector4) toSCNVector

Returns a representation of the Rotation as an SCNVector4. The Rotation's Axis will be represented in the first three components (x y z), while the angle will be in the last component (w). This is the most common representation, ready to be used with SceneKit.

Returns
An initialized SCNVector4.

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