# Class M3

java.lang.Object
javajs.util.M34
javajs.util.M3

All Implemented Interfaces:
  `Serializable`

public class M3 extends M34 implements Serializable
A single precision floating point 3 by 3 matrix.

Author:
  Kenji hiranabe additions by Bob Hanson hansonr@stolaf.edu 9/30/2012 for unique constructor and method names for the optimization of compiled JavaScript using Java2Script
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class M34

`m00, m01, m02, m10, m11, m12, m20, m21, m22`

## Constructor Summary

Constructors
Constructor
Description
`M3()`
Constructs and initializes a Matrix3f to all zeros.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(M3 m1)`
Sets the value of this matrix to sum of itself and matrix m1.
`boolean`
`equals(Object o)`
Returns true if the Object o is of type Matrix3f and all of the data members of t1 are equal to the corresponding data members in this Matrix3f.
`void`
`getColumn(int column, float[] v)`
Copies the matrix values in the specified column into the array parameter.
`void`
`getColumnV(int column, T3 v)`
Copies the matrix values in the specified column into the vector parameter.
`float`
`getElement(int row, int col)`
Retrieves the value at the specified row and column of this matrix.
`void`
`getRow(int row, float[] v)`
Copies the matrix values in the specified row into the array parameter.
`int`
`hashCode()`
Returns a hash number based on the data values in this object.
`void`
`invert()`
Sets the value of this matrix to its inverse.
`void`
`invertM(M3 m1)`
Sets the value of this matrix to the matrix inverse of the passed matrix m1.
`boolean`
`isRotation()`
`void`
`mul(M3 m1)`
Sets the value of this matrix to the result of multiplying itself with matrix m1.
`void`
`mul2(M3 m1, M3 m2)`
Sets the value of this matrix to the result of multiplying the two argument matrices together.
`static M3`
`newA9(float[] v)`
Constructs and initializes a Matrix3f from the specified 9 element array.
`static M3`
`newM3(M3 m1)`
Constructs a new matrix with the same values as the Matrix3f parameter.
`void`
`scale(float scalar)`
Multiplies each element of this matrix by a scalar.
`void`
`setA(float[] m)`
Sets the values in this Matrix3f equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).
`M3`
`setAA(A4 a)`
Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.
`boolean`
`setAsBallRotation(float responseFactor, float dx, float dy)`
3D ball rotation from dx dy in-plane mouse motion adapted from Andrew Hanson Computer Graphics beyond the Third Dimension: Geometry, Orientation Control, and Rendering for Graphics in Dimensions Greater than Three Course Notes for SIGGRAPH ’98 http://www.cse.ohio-state.edu/~hwshen/888_su02/hanson_note.pdf
`M3`
`setAsXRotation(float angle)`
Sets the value of this matrix to a rotation matrix about the x axis by the passed angle.
`M3`
`setAsYRotation(float angle)`
Sets the value of this matrix to a rotation matrix about the y axis by the passed angle.
`M3`
`setAsZRotation(float angle)`
Sets the value of this matrix to a rotation matrix about the z axis by the passed angle.
`void`
`setColumn3(int column, float x, float y, float z)`
Sets the specified column of this matrix3d to the three values provided.
`void`
`setColumnA(int column, float[] v)`
Sets the specified column of this matrix3d to the four values provided.
`void`
`setColumnV(int column, T3 v)`
Sets the specified column of this matrix3d to the vector provided.
`void`
`setElement(int row, int col, float v)`
Sets the specified element of this matrix3d to the value provided.
`void`
`setM3(M34 m1)`
Sets the value of this matrix to the double value of the Matrix3f argument.
`void`
`setRow(int row, float x, float y, float z)`
Sets the specified row of this matrix3d to the three values provided.
`void`
`setRowA(int row, float[] v)`
Sets the specified row of this matrix3d to the four values provided.
`void`
`setRowV(int row, T3 v)`
Sets the specified row of this matrix3d to the Vector provided.
`void`
`setScale(float scale)`
Sets this Matrix3f to a scalar * Identity.
`void`
`setZero()`
Sets this matrix to all zeros.
`void`
`sub(M3 m1)`
Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).
`String`
`toString()`
Returns a string that contains the values of this Matrix3f.
`void`
`transpose()`
Sets the value of this matrix to its transpose.
`void`
`transposeM(M3 m1)`
Sets the value of this matrix to the transpose of the argument matrix

### Methods inherited from class M34

`add33, clear33, determinant3, err, get33, getColumn33, getRow33, mul33, rotate, rotate2, set33, setAA33, setColumn33, setM33, setRow33, setXRot, setYRot, setZRot, sub33, transpose33`

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### M3

public M3()
Constructs and initializes a Matrix3f to all zeros.

## Method Details

### newA9

public static M3 newA9(float[] v)
Constructs and initializes a Matrix3f from the specified 9 element array. this.m00 =v[0], this.m01=v[1], etc.

Parameters:
  `v` - the array of length 9 containing in order
Returns:
  m

### newM3

public static M3 newM3(M3 m1)
Constructs a new matrix with the same values as the Matrix3f parameter.

Parameters:
  `m1` - The source matrix.
Returns:
  m

### setScale

public void setScale(float scale)
Sets this Matrix3f to a scalar * Identity.

Parameters:
  `scale` -

### setM3

public void setM3(M34 m1)
Sets the value of this matrix to the double value of the Matrix3f argument.

Parameters:
  `m1` - the matrix3f

### setA

public void setA(float[] m)
Sets the values in this Matrix3f equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).

Parameters:
  `m` -

### setElement

public void setElement(int row, int col, float v)
Sets the specified element of this matrix3d to the value provided.

Parameters:
  `row` - the row number to be modified (zero indexed)
  `col` - the column number to be modified (zero indexed)
  `v` - the new value

### getElement

public float getElement(int row, int col)
Retrieves the value at the specified row and column of this matrix.

Parameters:
  `row` - the row number to be retrieved (zero indexed)
  `col` - the column number to be retrieved (zero indexed)
Returns:
  the value at the indexed element

### setRow

public void setRow(int row, float x, float y, float z)
Sets the specified row of this matrix3d to the three values provided.

Parameters:
  `row` - the row number to be modified (zero indexed)
  `x` - the first column element
  `y` - the second column element
  `z` - the third column element

### setRowV

public void setRowV(int row, T3 v)
Sets the specified row of this matrix3d to the Vector provided.

Parameters:
  `row` - the row number to be modified (zero indexed)
  `v` - the replacement row

### setRowA

public void setRowA(int row, float[] v)
Sets the specified row of this matrix3d to the four values provided.

Parameters:
  `row` - the row number to be modified (zero indexed)
  `v` - the replacement row

### getRow

public void getRow(int row, float[] v)
Copies the matrix values in the specified row into the array parameter.

Specified by:
  `getRow` in class `M34`
Parameters:
  `row` - the matrix row
  `v` - The array into which the matrix row values will be copied

### setColumn3

public void setColumn3(int column, float x, float y, float z)
Sets the specified column of this matrix3d to the three values provided.

Parameters:
  `column` - the column number to be modified (zero indexed)
  `x` - the first row element
  `y` - the second row element
  `z` - the third row element

### setColumnV

public void setColumnV(int column, T3 v)
Sets the specified column of this matrix3d to the vector provided.

Parameters:
  `column` - the column number to be modified (zero indexed)
  `v` - the replacement column

### getColumnV

public void getColumnV(int column, T3 v)
Copies the matrix values in the specified column into the vector parameter.

Parameters:
  `column` - the matrix column
  `v` - The vector into which the matrix row values will be copied

### setColumnA

public void setColumnA(int column, float[] v)
Sets the specified column of this matrix3d to the four values provided.

Parameters:
  `column` - the column number to be modified (zero indexed)
  `v` - the replacement column

### getColumn

public void getColumn(int column, float[] v)
Copies the matrix values in the specified column into the array parameter.

Parameters:
  `column` - the matrix column
  `v` - The array into which the matrix row values will be copied

### add

public void add(M3 m1)
Sets the value of this matrix to sum of itself and matrix m1.

Parameters:
  `m1` - the other matrix

### sub

public void sub(M3 m1)
Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).

Parameters:
  `m1` - the other matrix

### transpose

public void transpose()
Sets the value of this matrix to its transpose.

### transposeM

public void transposeM(M3 m1)
Sets the value of this matrix to the transpose of the argument matrix

Parameters:
  `m1` - the matrix to be transposed

### invertM

public void invertM(M3 m1)
Sets the value of this matrix to the matrix inverse of the passed matrix m1.

Parameters:
  `m1` - the matrix to be inverted

### invert

public void invert()
Sets the value of this matrix to its inverse.

### setAsXRotation

public M3 setAsXRotation(float angle)
Sets the value of this matrix to a rotation matrix about the x axis by the passed angle.

Parameters:
  `angle` - the angle to rotate about the X axis in radians
Returns:
  this

### setAsYRotation

public M3 setAsYRotation(float angle)
Sets the value of this matrix to a rotation matrix about the y axis by the passed angle.

Parameters:
  `angle` - the angle to rotate about the Y axis in radians
Returns:
  this

### setAsZRotation

public M3 setAsZRotation(float angle)
Sets the value of this matrix to a rotation matrix about the z axis by the passed angle.

Parameters:
  `angle` - the angle to rotate about the Z axis in radians
Returns:
  this

### scale

public void scale(float scalar)
Multiplies each element of this matrix by a scalar.

Parameters:
  `scalar` - The scalar multiplier.

### mul

public void mul(M3 m1)
Sets the value of this matrix to the result of multiplying itself with matrix m1.

Parameters:
  `m1` - the other matrix

### mul2

public void mul2(M3 m1, M3 m2)
Sets the value of this matrix to the result of multiplying the two argument matrices together.

Parameters:
  `m1` - the first matrix
  `m2` - the second matrix

### equals

public boolean equals(Object o)
Returns true if the Object o is of type Matrix3f and all of the data members of t1 are equal to the corresponding data members in this Matrix3f.

Overrides:
  `equals` in class `Object`
Parameters:
  `o` - the object with which the comparison is made.

### hashCode

public int hashCode()
Returns a hash number based on the data values in this object. Two different Matrix3f objects with identical data values (ie, returns true for equals(Matrix3f) ) will return the same hash number. Two objects with different data members may return the same hash value, although this is not likely.

Overrides:
  `hashCode` in class `Object`
Returns:
  the integer hash value

### setZero

public void setZero()
Sets this matrix to all zeros.

### toString

public String toString()
Returns a string that contains the values of this Matrix3f.

Overrides:
  `toString` in class `Object`
Returns:
  the String representation

### setAA

public M3 setAA(A4 a)
Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.

Parameters:
  `a` - the axis and angle to be converted
Returns:
  this

### setAsBallRotation

public boolean setAsBallRotation(float responseFactor, float dx, float dy)
3D ball rotation from dx dy in-plane mouse motion adapted from Andrew Hanson Computer Graphics beyond the Third Dimension: Geometry, Orientation Control, and Rendering for Graphics in Dimensions Greater than Three Course Notes for SIGGRAPH ’98 http://www.cse.ohio-state.edu/~hwshen/888_su02/hanson_note.pdf

Parameters:
  `responseFactor` - Jmol uses 0.02 here
  `dx` -
  `dy` -
Returns:
  true if successful; false if not;

### isRotation

public boolean isRotation()