MaplyMatrix

Objective-C

@interface MaplyMatrix : NSObject

Swift

class MaplyMatrix : NSObject

Represents a matrix for position manipulation.

Encapsulates a 4x4 matrix used for object placement and other things. This is more a wrapper than a full service object.

  • Construct with yaw, pitch, and roll parameters.

    Construct the matrix with the standard yaw, pitch, and roll used by aircraft.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithYaw:(double)yaw
                                  pitch:(double)pitch
                                   roll:(double)roll;

    Swift

    init(yaw: Double, pitch: Double, roll: Double)
  • Construct with a consistent scale in each dimension.

    Construct with the same scale in x,y, and z.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithScale:(double)scale;

    Swift

    init(scale: Double)
  • Construct with a translation.

    Construct with a translation in 3D.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithTranslateX:(double)x y:(double)y z:(double)z;

    Swift

    init(translateX x: Double, y: Double, z: Double)
  • Construct a rotation around the given axis.

    Build a matrix that rotates the given amount (in radians) around the given axis.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAngle:(double)ang
                                    axisX:(double)x
                                    axisY:(double)y
                                    axisZ:(double)z;

    Swift

    init(angle ang: Double, axisX x: Double, axisY y: Double, axisZ z: Double)
  • Multiply the given matrix with this one and return a new one.

    Multiply the given matrix like so: ret = this * other. Return the new one.

    Declaration

    Objective-C

    - (nonnull instancetype)multiplyWith:(MaplyMatrix *_Nonnull)other;

    Swift

    func multiply(with other: MaplyMatrix) -> Self