Package javajs.util
Class M3
java.lang.Object
javajs.util.M34
javajs.util.M3
- All Implemented Interfaces:
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:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the value of this matrix to sum of itself and matrix m1.boolean
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
Sets the value of this matrix to the matrix inverse of the passed matrix m1.boolean
void
Sets the value of this matrix to the result of multiplying itself with matrix m1.void
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
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.).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.pdfsetAsXRotation
(float angle) Sets the value of this matrix to a rotation matrix about the x axis by the passed angle.setAsYRotation
(float angle) Sets the value of this matrix to a rotation matrix about the y axis by the passed angle.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
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
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
Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).toString()
Returns a string that contains the values of this Matrix3f.void
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
-
Constructor Details
-
M3
public M3()Constructs and initializes a Matrix3f to all zeros.
-
-
Method Details
-
newA9
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
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
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 elementy
- the second column elementz
- the third column element
-
setRowV
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. -
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 elementy
- the second row elementz
- the third row element
-
setColumnV
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
Copies the matrix values in the specified column into the vector parameter.- Parameters:
column
- the matrix columnv
- 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 columnv
- The array into which the matrix row values will be copied
-
add
Sets the value of this matrix to sum of itself and matrix m1.- Parameters:
m1
- the other matrix
-
sub
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
Sets the value of this matrix to the transpose of the argument matrix- Parameters:
m1
- the matrix to be transposed
-
invertM
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
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
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
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
Sets the value of this matrix to the result of multiplying itself with matrix m1.- Parameters:
m1
- the other matrix
-
mul2
Sets the value of this matrix to the result of multiplying the two argument matrices together.- Parameters:
m1
- the first matrixm2
- the second matrix
-
equals
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. -
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. -
setZero
public void setZero()Sets this matrix to all zeros. -
toString
Returns a string that contains the values of this Matrix3f. -
setAA
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 heredx
-dy
-- Returns:
- true if successful; false if not;
-
isRotation
public boolean isRotation()
-