Class b2Mat22

A 2-by-2 matrix. Stored in column-major order.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): b2Mat22

Empty constructor

Returns

b2Mat22

Properties

public col1: b2Vec2

Column 1

public col2: b2Vec2

Column 2

Methods

public Abs()

Sets all internal matrix values to absolute values.

public AddM(m: b2Mat22)

Adds the two 2x2 matricies together and stores the result in this matrix.

Parameters

public Copy(): b2Mat22

Creates a copy of the matrix.

Returns

b2Mat22

Copy of this 2x2 matrix.

public static FromAngle(angle: number): b2Mat22

Creates a rotation 2x2 matrix from the given angle. R(theta) = [ cos(theta) -sin(theta) ] [ sin(theta) cos(theta) ]

Parameters

  • angle: number

    Matrix angle (theta).

Returns

b2Mat22

2x2 matrix.

public static FromVV(c1: b2Vec2, c2: b2Vec2): b2Mat22

Creates a 2x2 matrix from two columns.

Parameters

Returns

b2Mat22

2x2 matrix.

public GetAngle(): number

Gets the rotation matrix angle. R(theta) = [ cos(theta) -sin(theta) ] [ sin(theta) cos(theta) ]

Returns

number

The rotation matrix angle (theta).

public GetInverse(out: b2Mat22): b2Mat22

Compute the inverse of this matrix, such that inv(A) A = identity.

Parameters

Returns

b2Mat22

Inverse matrix.

public Set(angle: number)

Sets the 2x2 rotation matrix from the given angle. R(theta) = [ cos(theta) -sin(theta) ] [ sin(theta) cos(theta) ]

Parameters

  • angle: number

    Matrix angle (theta).

public SetIdentity()

Sets the 2x2 matrix to identity.

public SetM(m: b2Mat22)

Sets the 2x2 matrix from a 2x2 matrix.

Parameters

public SetVV(c1: b2Vec2, c2: b2Vec2)

Sets the 2x2 matrix from 2 column vectors.

Parameters

public SetZero()

Sets the 2x2 matrix to all zeros.

public Solve(out: b2Vec2, bX: number, bY: number): b2Vec2

TODO, has something to do with the determinant

Parameters

  • out: b2Vec2

    Solved vector

  • bX: number
  • bY: number

Returns

b2Vec2

Solved vector