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.
-
– init
Initializes an identity matrix.
-
+ matrixWithA:b:c:d:tx:ty:
Factory method.
-
+ matrixWithIdentity
Factory 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).
-
– identity
Sets each matrix property to a value that causes a null transformation.
-
– invert
Performs the opposite transformation of the matrix.
-
– copyFromMatrix:
-
– convertToGLKMatrix4
Creates a 3D GLKit matrix that is equivalent to this instance.
-
– convertToGLKMatrix3
Creates 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
-
a
The a component of the matrix.
property -
b
The b component of the matrix.
property -
c
The c component of the matrix.
property -
d
The d component of the matrix.
property -
tx
The tx component of the matrix.
property -
ty
The ty component of the matrix.
property -
determinant
The determinant of the matrix.
property -
rotation
The rotation of the matrix in radians.
property -
scaleX
The horizontal scale of the matrix.
property -
scaleY
The vertical scale of the matrix.
property -
skewX
The horizontal skew angle in radians.
property -
skewY
The vertical skew angle in radians.
property
Properties
a
The a component of the matrix.
@property (nonatomic, assign) float a
Discussion
The a component of the matrix.
Declared In
SPMatrix.h
b
The b component of the matrix.
@property (nonatomic, assign) float b
Discussion
The b component of the matrix.
Declared In
SPMatrix.h
c
The c component of the matrix.
@property (nonatomic, assign) float c
Discussion
The c component of the matrix.
Declared In
SPMatrix.h
d
The d component of the matrix.
@property (nonatomic, assign) float d
Discussion
The d component of the matrix.
Declared In
SPMatrix.h
determinant
The determinant of the matrix.
@property (nonatomic, readonly) float determinant
Discussion
The determinant of the matrix.
Declared In
SPMatrix.h
rotation
The rotation of the matrix in radians.
@property (nonatomic, readonly) float rotation
Discussion
The rotation of the matrix in radians.
Declared In
SPMatrix.h
scaleX
The horizontal scale of the matrix.
@property (nonatomic, readonly) float scaleX
Discussion
The horizontal scale of the matrix.
Declared In
SPMatrix.h
scaleY
The vertical scale of the matrix.
@property (nonatomic, readonly) float scaleY
Discussion
The vertical scale of the matrix.
Declared In
SPMatrix.h
skewX
The horizontal skew angle in radians.
@property (nonatomic, readonly) float skewX
Discussion
The horizontal skew angle in radians.
Declared In
SPMatrix.h
skewY
The vertical skew angle in radians.
@property (nonatomic, readonly) float skewY
Discussion
The vertical skew angle in radians.
Declared In
SPMatrix.h
Class 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)ty
Discussion
Factory method.
Declared In
SPMatrix.h
matrixWithIdentity
Factory method.
+ (instancetype)matrixWithIdentity
Discussion
Factory method.
Declared In
SPMatrix.h
matrixWithRotation:
Factory method.
+ (instancetype)matrixWithRotation:(float)angle
Discussion
Factory method.
Declared In
SPMatrix.h
Instance Methods
appendMatrix:
Appends the matrix by multiplying another matrix by the current matrix.
- (void)appendMatrix:(SPMatrix *)lhs
Discussion
Appends the matrix by multiplying another matrix by the current matrix.
Declared In
SPMatrix.h
convertToGLKMatrix3
Creates a 2D GLKit matrix that is equivalent to this instance.
- (GLKMatrix3)convertToGLKMatrix3
Discussion
Creates a 2D GLKit matrix that is equivalent to this instance.
Declared In
SPMatrix.h
convertToGLKMatrix4
Creates a 3D GLKit matrix that is equivalent to this instance.
- (GLKMatrix4)convertToGLKMatrix4
Discussion
Creates a 3D GLKit matrix that is equivalent to this instance.
Declared In
SPMatrix.h
identity
Sets each matrix property to a value that causes a null transformation.
- (void)identity
Discussion
Sets each matrix property to a value that causes a null transformation.
Declared In
SPMatrix.h
init
Initializes an identity matrix.
- (instancetype)init
Discussion
Initializes an identity matrix.
Declared In
SPMatrix.h
initWithA: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)ty
Discussion
Initializes a matrix with the specified components. Designated Initializer.
Declared In
SPMatrix.h
invert
Performs the opposite transformation of the matrix.
- (void)invert
Discussion
Performs the opposite transformation of the matrix.
Declared In
SPMatrix.h
isEqualToMatrix:
Compares two matrices.
- (BOOL)isEqualToMatrix:(SPMatrix *)other
Discussion
Compares two matrices.
Declared In
SPMatrix.h
prependMatrix:
Prepends a matrix by multiplying the current matrix by another matrix.
- (void)prependMatrix:(SPMatrix *)rhs
Discussion
Prepends a matrix by multiplying the current matrix by another matrix.
Declared In
SPMatrix.h
rotateBy:
Applies a rotation on the matrix (angle in RAD).
- (void)rotateBy:(float)angle
Discussion
Applies a rotation on the matrix (angle in RAD).
Declared In
SPMatrix.h
scaleBy:
Applies a uniform scaling transformation to the matrix.
- (void)scaleBy:(float)scale
Discussion
Applies a uniform scaling transformation to the matrix.
Declared In
SPMatrix.h
scaleXBy:yBy:
Applies a scaling transformation to the matrix.
- (void)scaleXBy:(float)sx yBy:(float)sy
Discussion
Applies a scaling transformation to the matrix.
Declared In
SPMatrix.h
setA: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)ty
Discussion
Sets all components simultaneously.
Declared In
SPMatrix.h
skewXBy:yBy:
Appends a skew transformation to a matrix (angles in radians). The skew matrix has the following form:
- (void)skewXBy:(float)sx yBy:(float)sy
Discussion
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.h
transformPoint:
Applies the geometric transformation represented by the matrix to the specified point.
- (SPPoint *)transformPoint:(SPPoint *)point
Discussion
Applies the geometric transformation represented by the matrix to the specified point.
Declared In
SPMatrix.h