Skip to main content

Matrix

Code Example

::STAR::Matrix a( 0, 1, 0 );

::STAR::Matrix b(); // will be initialised to( 0 )

::STAR::Matrix c = a + b;

Constructor

Matix matrix(
Scalar xx, Scalar xy, Scalar xz,
Scalar yx, Scalar yy, Scalar yz,
Scalar zx, Scalar zy, Scalar zz
)

Matrix matrix(Vector x, Vector y, Vector z)

Matrix matrix(Matrix m)
  • x - the x vector of this matrix. Default is Vector(0, 0, 0)
  • y - the y vector of this matrix. Default is Vector(0, 0, 0)
  • z - the z vector of this matrix. Default is Vector(0, 0, 0)

Methods

Basic Properties Methods

Basic Operations

PropertiesDescription
.[0]: VectorReturns the vector x of this matrix.
.[1]: VectorReturns the vector y of this matrix.
.[2]: VectorReturns the vector z of this matrix.

Basic Getter Methods

PropertiesDescription
.x(): ScalarReturns the value x of this matrix.
.y(): ScalarReturns the value y of this matrix.
.z(): ScalarReturns the value z of this matrix.
.print(): void

Basic Setter Methods

PropertiesDescription
.set(Scalar s): thisCopies the value to this Matrix x, y, z.
.set(Matrix m): thisCopies the values x, y, z of to this Matrix.
.set_rotation_x(Scalar s): thisCopies [1000cosθsinθ0sinθcosθ]\begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta \\ 0 & \sin \theta & \cos \theta \end{bmatrix}
.set_rotation_y(Scalar s): thisCopies [cosθ0sinθ010sinθ0cosθ]\begin{bmatrix} \cos \theta & 0 & \sin \theta \\ 0 & 1 & 0 \\ -\sin \theta & 0 & \cos \theta \end{bmatrix}
.set_rotation_z(Scalar s): thisCopies [cosθsinθ0sinθcosθ0001]\begin{bmatrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{bmatrix}

Basic Math Methods

Basic Operations

PropertiesDescription
+(): Matrix
-(): Matrix
+(Scalar s): Matrix
-(Scalar s): Matrix
*(Scalar s): Matrix
/(Scalar s): Matrix
+(Matrix m): MatrixCalculates the dot add product of this matrix and v.
-(Matrix m): MatrixCalculates the dot sub product of this matrix and v.
*(Matrix m): MatrixCalculates the cross product of this matrix and v.
*(Vector v): VectorCalculates the cross product of this matrix and v.

Basic Calculations

PropertiesDescription
.tdotx( Vector v ): VectorCalculates the dot product of this matrix x and v.
.tdoty( Vector v ): VectorCalculates the dot product of this matrix y and v.
.tdotz( Vector v ): VectorCalculates the dot product of this matrix z and v.