EngineKit
Vector Class Reference

#import <Vector.h>

Inheritance diagram for Vector:
<VectorExport> Axis Position

Instance Methods

(instancetype) - initUniformWithNumber:
 
(instancetype) - initWithX:Y:Z:
 
(instancetype) - initWithSCNVector:
 
(instancetype) - initWithSCNVector4:
 
(instancetype) - initWithCIVector:
 
(instancetype) - initWithVector:
 
(instancetype) - initWithArray:
 
(instancetype) - initWithObject:
 
(BOOL) - isEqualToVector:
 
(SCNVector3) - toSCNVector
 

Class Methods

(instancetype) + origin
 

Properties

SCNVector3 vector
 
CGFloat x
 The Vector's x component.
 
CGFloat y
 The Vector's y component.
 
CGFloat z
 The Vector's z component.
 
- Properties inherited from <VectorExport>
CGFloat x
 
CGFloat y
 
CGFloat z
 

Detailed Description

Represents a tuple of three CGFloats, here named x, y and z.

Method Documentation

- (instancetype) initUniformWithNumber: (CGFloat)  x

Creates a Vector in which all components are set to x. Useful for uniform scales.

Parameters
xThe value to set to all the Vector's components.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithArray: (NSArray *)  array

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

Parameters
arrayThe array to copy into the Vector.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithCIVector: (CIVector *)  newValue

Creates a Vector in which all components are set as just as the first 3 components (x, y and z) in the given CIVector. This method trusts that the CIVector has been correctly initialized and has the necessary components.

Useful for obtaining a Vector through a CIVector initialization method.

Parameters
newValueThe CIValue whose x, y and z components should be used.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithObject: (id)  object

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

  • NSNumber, which will be initialized just like -initUniformWithNumber.
  • NSArray, which will be initialized just like -initWithArray.
  • NSValue containing a SCNVector3, which will be initialized just like -initWithSCNVector3.
  • Vector (or any of its subclassses, which will be initialized just like -initWithVector.
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 Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithSCNVector4: (SCNVector4)  newValue

Creates a Vector in which all components are set as just as the first 3 components in the given SCNVector4. If that vector is written as (x y z w), the created Vector object will be (x y z).

Useful for obtaining the axis of a rotation, for instance.

Parameters
newValueThe SCNVector4 whose first three components should be used.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithSCNVector: (SCNVector3)  newValue

Creates a Vector in which all components are set as just as the given SCNVector3.

Parameters
newValueThe SCNVector3 that should be used as a model.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithVector: (Vector *)  vector

Creates a Vector that is a copy of the given vector.

Parameters
vectorThe Vector object that should be copied.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (instancetype) initWithX: (CGFloat)  x
Y: (CGFloat)  y
Z: (CGFloat)  z 

Creates a Vector in which all components are set as specified: (x y z).

Parameters
xThe Vector's first component.
yThe Vector's second component.
zThe Vector's third component.
Returns
An initialized Vector object.

Reimplemented from <VectorExport>.

- (BOOL) isEqualToVector: (SCNVector3)  vector

Returns YES if the Vector has the same components as the given vector, as determined by the SCNVector3EqualToVector3 function.

Parameters
vectorThe SCNVector3 used for comparison.
Returns
YES if the components are all the same; NO otherwise.

Reimplemented from <VectorExport>.

+ (instancetype) origin

Represents a commonly used Vector, (0 0 0)

Returns
An origin Vector object.

Reimplemented from <VectorExport>.

- (SCNVector3) toSCNVector

Creates an SCNVector3 with the same components as the Vector.

Returns
An initialized SCNVector3.

Reimplemented from <VectorExport>.

Property Documentation

- (SCNVector3) vector
readwritenonatomicassign

The Vector class's inner representation of a vector. Meant to be used only by subclasses; use -toSCNVector instead.


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