SPMatrix Class Reference
| Inherits from | SPPoolObject : NSObject |
| Conforms to | NSCopying |
| Declared in | SPMatrix.h |
Overview
The SPMatrix class describes an affine, 2D transformation Matrix. It provides methods to manipulate the matrix in convenient ways, and can be used to transform points.
The matrix has the following form:
|a c tx|
|b d ty|
|0 0 1|
Tasks
Initialization
-
– initWithA:b:c:d:tx:ty:Initializes a matrix with the specified components. Designated Initializer.
-
– initInitializes an identity matrix.
-
+ matrixWithA:b:c:d:tx:ty:Factory method.
-
+ matrixWithIdentityFactory method.
-
+ matrixWithRotation:Factory method.
-
+ matrixWithScaleX:scaleY:Factory method.
-
+ matrixWithTranslationX:translationY:Factory method.
Methods
-
– setA:b:c:d:tx:ty:Sets all components simultaneously.
-
– isEqualToMatrix:Compares two matrices.
-
– appendMatrix:Appends the matrix by multiplying another matrix by the current matrix.
-
– prependMatrix:Prepends a matrix by multiplying the current matrix by another matrix.
-
– translateXBy:yBy:Translates the matrix along the x and y axes.
-
– scaleXBy:yBy:Applies a scaling transformation to the matrix.
-
– skewXBy:yBy:Appends a skew transformation to a matrix (angles in radians). The skew matrix has the following form:
-
– scaleBy:Applies a uniform scaling transformation to the matrix.
-
– rotateBy:Applies a rotation on the matrix (angle in RAD).
-
– identitySets each matrix property to a value that causes a null transformation.
-
– invertPerforms the opposite transformation of the matrix.
-
– copyFromMatrix: -
– convertToGLKMatrix4Creates a 3D GLKit matrix that is equivalent to this instance.
-
– convertToGLKMatrix3Creates a 2D GLKit matrix that is equivalent to this instance.
-
– transformPoint:Applies the geometric transformation represented by the matrix to the specified point.
-
– transformPointWithX:y:Applies the geometric transformation represented by the matrix to the specified coordinates.
Properties
-
aThe a component of the matrix.
property -
bThe b component of the matrix.
property -
cThe c component of the matrix.
property -
dThe d component of the matrix.
property -
txThe tx component of the matrix.
property -
tyThe ty component of the matrix.
property -
determinantThe determinant of the matrix.
property -
rotationThe rotation of the matrix in radians.
property -
scaleXThe horizontal scale of the matrix.
property -
scaleYThe vertical scale of the matrix.
property -
skewXThe horizontal skew angle in radians.
property -
skewYThe vertical skew angle in radians.
property
Properties
a
The a component of the matrix.
@property (nonatomic, assign) float aDiscussion
The a component of the matrix.
Declared In
SPMatrix.hb
The b component of the matrix.
@property (nonatomic, assign) float bDiscussion
The b component of the matrix.
Declared In
SPMatrix.hc
The c component of the matrix.
@property (nonatomic, assign) float cDiscussion
The c component of the matrix.
Declared In
SPMatrix.hd
The d component of the matrix.
@property (nonatomic, assign) float dDiscussion
The d component of the matrix.
Declared In
SPMatrix.hdeterminant
The determinant of the matrix.
@property (nonatomic, readonly) float determinantDiscussion
The determinant of the matrix.
Declared In
SPMatrix.hrotation
The rotation of the matrix in radians.
@property (nonatomic, readonly) float rotationDiscussion
The rotation of the matrix in radians.
Declared In
SPMatrix.hscaleX
The horizontal scale of the matrix.
@property (nonatomic, readonly) float scaleXDiscussion
The horizontal scale of the matrix.
Declared In
SPMatrix.hscaleY
The vertical scale of the matrix.
@property (nonatomic, readonly) float scaleYDiscussion
The vertical scale of the matrix.
Declared In
SPMatrix.hskewX
The horizontal skew angle in radians.
@property (nonatomic, readonly) float skewXDiscussion
The horizontal skew angle in radians.
Declared In
SPMatrix.hskewY
The vertical skew angle in radians.
@property (nonatomic, readonly) float skewYDiscussion
The vertical skew angle in radians.
Declared In
SPMatrix.hClass Methods
matrixWithA:b:c:d:tx:ty:
Factory method.
+ (instancetype)matrixWithA:(float)a b:(float)b c:(float)c d:(float)d tx:(float)tx ty:(float)tyDiscussion
Factory method.
Declared In
SPMatrix.hmatrixWithIdentity
Factory method.
+ (instancetype)matrixWithIdentityDiscussion
Factory method.
Declared In
SPMatrix.hmatrixWithRotation:
Factory method.
+ (instancetype)matrixWithRotation:(float)angleDiscussion
Factory method.
Declared In
SPMatrix.hInstance Methods
appendMatrix:
Appends the matrix by multiplying another matrix by the current matrix.
- (void)appendMatrix:(SPMatrix *)lhsDiscussion
Appends the matrix by multiplying another matrix by the current matrix.
Declared In
SPMatrix.hconvertToGLKMatrix3
Creates a 2D GLKit matrix that is equivalent to this instance.
- (GLKMatrix3)convertToGLKMatrix3Discussion
Creates a 2D GLKit matrix that is equivalent to this instance.
Declared In
SPMatrix.hconvertToGLKMatrix4
Creates a 3D GLKit matrix that is equivalent to this instance.
- (GLKMatrix4)convertToGLKMatrix4Discussion
Creates a 3D GLKit matrix that is equivalent to this instance.
Declared In
SPMatrix.hidentity
Sets each matrix property to a value that causes a null transformation.
- (void)identityDiscussion
Sets each matrix property to a value that causes a null transformation.
Declared In
SPMatrix.hinit
Initializes an identity matrix.
- (instancetype)initDiscussion
Initializes an identity matrix.
Declared In
SPMatrix.hinitWithA:b:c:d:tx:ty:
Initializes a matrix with the specified components. Designated Initializer.
- (instancetype)initWithA:(float)a b:(float)b c:(float)c d:(float)d tx:(float)tx ty:(float)tyDiscussion
Initializes a matrix with the specified components. Designated Initializer.
Declared In
SPMatrix.hinvert
Performs the opposite transformation of the matrix.
- (void)invertDiscussion
Performs the opposite transformation of the matrix.
Declared In
SPMatrix.hisEqualToMatrix:
Compares two matrices.
- (BOOL)isEqualToMatrix:(SPMatrix *)otherDiscussion
Compares two matrices.
Declared In
SPMatrix.hprependMatrix:
Prepends a matrix by multiplying the current matrix by another matrix.
- (void)prependMatrix:(SPMatrix *)rhsDiscussion
Prepends a matrix by multiplying the current matrix by another matrix.
Declared In
SPMatrix.hrotateBy:
Applies a rotation on the matrix (angle in RAD).
- (void)rotateBy:(float)angleDiscussion
Applies a rotation on the matrix (angle in RAD).
Declared In
SPMatrix.hscaleBy:
Applies a uniform scaling transformation to the matrix.
- (void)scaleBy:(float)scaleDiscussion
Applies a uniform scaling transformation to the matrix.
Declared In
SPMatrix.hscaleXBy:yBy:
Applies a scaling transformation to the matrix.
- (void)scaleXBy:(float)sx yBy:(float)syDiscussion
Applies a scaling transformation to the matrix.
Declared In
SPMatrix.hsetA:b:c:d:tx:ty:
Sets all components simultaneously.
- (void)setA:(float)a b:(float)b c:(float)c d:(float)d tx:(float)tx ty:(float)tyDiscussion
Sets all components simultaneously.
Declared In
SPMatrix.hskewXBy:yBy:
Appends a skew transformation to a matrix (angles in radians). The skew matrix has the following form:
- (void)skewXBy:(float)sx yBy:(float)syDiscussion
Appends a skew transformation to a matrix (angles in radians). The skew matrix has the following form:
| cos(skewY) -sin(skewX) 0 |
| sin(skewY) cos(skewX) 0 |
| 0 0 1 |
Declared In
SPMatrix.htransformPoint:
Applies the geometric transformation represented by the matrix to the specified point.
- (SPPoint *)transformPoint:(SPPoint *)pointDiscussion
Applies the geometric transformation represented by the matrix to the specified point.
Declared In
SPMatrix.h