public class Matrix3x2d extends Object implements Matrix3x2dc, Externalizable
m00 m10 m20
m01 m11 m21
| Modifier and Type | Field and Description |
|---|---|
double |
m00 |
double |
m01 |
double |
m10 |
double |
m11 |
double |
m20 |
double |
m21 |
| Constructor and Description |
|---|
Matrix3x2d()
Create a new
Matrix3x2d and set it to identity. |
Matrix3x2d(DoubleBuffer buffer)
Create a new
Matrix3x2d by reading its 6 double components from the given DoubleBuffer
at the buffer's current position. |
Matrix3x2d(double m00,
double m01,
double m10,
double m11,
double m20,
double m21)
Create a new 3x2 matrix using the supplied double values.
|
Matrix3x2d(Matrix2dc mat)
Create a new
Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2dc
and the rest to identity. |
Matrix3x2d(Matrix2fc mat)
Create a new
Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2fc
and the rest to identity. |
Matrix3x2d(Matrix3x2dc mat)
Create a new
Matrix3x2d and make it a copy of the given matrix. |
| Modifier and Type | Method and Description |
|---|---|
Matrix3x2d |
_m00(double m00)
Set the value of the matrix element at column 0 and row 0.
|
Matrix3x2d |
_m01(double m01)
Set the value of the matrix element at column 0 and row 1.
|
Matrix3x2d |
_m10(double m10)
Set the value of the matrix element at column 1 and row 0.
|
Matrix3x2d |
_m11(double m11)
Set the value of the matrix element at column 1 and row 1.
|
Matrix3x2d |
_m20(double m20)
Set the value of the matrix element at column 2 and row 0.
|
Matrix3x2d |
_m21(double m21)
Set the value of the matrix element at column 2 and row 1.
|
double |
determinant()
Return the determinant of this matrix.
|
boolean |
equals(Matrix3x2dc m,
double delta)
Compare the matrix elements of
this matrix with the given matrix using the given delta
and return whether all of them are equal within a maximum difference of delta. |
boolean |
equals(Object obj) |
ByteBuffer |
get(ByteBuffer buffer)
Store this matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
double[] |
get(double[] arr)
Store this matrix into the supplied double array in column-major order.
|
double[] |
get(double[] arr,
int offset)
Store this matrix into the supplied double array in column-major order at the given offset.
|
DoubleBuffer |
get(DoubleBuffer buffer)
Store this matrix in column-major order into the supplied
DoubleBuffer at the current
buffer position. |
ByteBuffer |
get(int index,
ByteBuffer buffer)
Store this matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
DoubleBuffer |
get(int index,
DoubleBuffer buffer)
Store this matrix in column-major order into the supplied
DoubleBuffer starting at the specified
absolute buffer position/index. |
Matrix3x2d |
get(Matrix3x2d dest)
Get the current values of
this matrix and store them into
dest. |
ByteBuffer |
get3x3(ByteBuffer buffer)
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
double[] |
get3x3(double[] arr)
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array.
|
double[] |
get3x3(double[] arr,
int offset)
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array at the given offset.
|
DoubleBuffer |
get3x3(DoubleBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied
DoubleBuffer at the current
buffer position. |
ByteBuffer |
get3x3(int index,
ByteBuffer buffer)
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
DoubleBuffer |
get3x3(int index,
DoubleBuffer buffer)
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied
DoubleBuffer starting at the specified
absolute buffer position/index. |
ByteBuffer |
get4x4(ByteBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
double[] |
get4x4(double[] arr)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array.
|
double[] |
get4x4(double[] arr,
int offset)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array at the given offset.
|
DoubleBuffer |
get4x4(DoubleBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied
DoubleBuffer at the current
buffer position. |
ByteBuffer |
get4x4(int index,
ByteBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
DoubleBuffer |
get4x4(int index,
DoubleBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied
DoubleBuffer starting at the specified
absolute buffer position/index. |
int |
hashCode() |
Matrix3x2d |
identity()
Set this matrix to the identity.
|
Matrix3x2d |
invert()
Invert this matrix by assuming a third row in this matrix of
(0, 0, 1). |
Matrix3x2d |
invert(Matrix3x2d dest)
Invert the
this matrix by assuming a third row in this matrix of (0, 0, 1)
and store the result in dest. |
double |
m00()
Return the value of the matrix element at column 0 and row 0.
|
double |
m01()
Return the value of the matrix element at column 0 and row 1.
|
double |
m10()
Return the value of the matrix element at column 1 and row 0.
|
double |
m11()
Return the value of the matrix element at column 1 and row 1.
|
double |
m20()
Return the value of the matrix element at column 2 and row 0.
|
double |
m21()
Return the value of the matrix element at column 2 and row 1.
|
Matrix3x2d |
mul(Matrix3x2dc right)
Multiply this matrix by the supplied
right matrix by assuming a third row in
both matrices of (0, 0, 1). |
Matrix3x2d |
mul(Matrix3x2dc right,
Matrix3x2d dest)
Multiply this matrix by the supplied
right matrix by assuming a third row in
both matrices of (0, 0, 1) and store the result in dest. |
Matrix3x2d |
mulLocal(Matrix3x2dc left)
Pre-multiply this matrix by the supplied
left matrix and store the result in this. |
Matrix3x2d |
mulLocal(Matrix3x2dc left,
Matrix3x2d dest)
Pre-multiply this matrix by the supplied
left matrix and store the result in dest. |
Vector2d |
normalizedPositiveX(Vector2d dir)
Obtain the direction of
+X before the transformation represented by this orthogonal matrix is applied. |
Vector2d |
normalizedPositiveY(Vector2d dir)
Obtain the direction of
+Y before the transformation represented by this orthogonal matrix is applied. |
Vector2d |
origin(Vector2d origin)
Obtain the position that gets transformed to the origin by
this matrix. |
Vector2d |
positiveX(Vector2d dir)
Obtain the direction of
+X before the transformation represented by this matrix is applied. |
Vector2d |
positiveY(Vector2d dir)
Obtain the direction of
+Y before the transformation represented by this matrix is applied. |
void |
readExternal(ObjectInput in) |
Matrix3x2d |
rotate(double ang)
Apply a rotation transformation to this matrix by rotating the given amount of radians.
|
Matrix3x2d |
rotate(double ang,
Matrix3x2d dest)
Apply a rotation transformation to this matrix by rotating the given amount of radians and store the result in
dest. |
Matrix3x2d |
rotateAbout(double ang,
double x,
double y)
Apply a rotation transformation to this matrix by rotating the given amount of radians about
the specified rotation center
(x, y). |
Matrix3x2d |
rotateAbout(double ang,
double x,
double y,
Matrix3x2d dest)
Apply a rotation transformation to this matrix by rotating the given amount of radians about
the specified rotation center
(x, y) and store the result in dest. |
Matrix3x2d |
rotateLocal(double ang)
Pre-multiply a rotation to this matrix by rotating the given amount of radians.
|
Matrix3x2d |
rotateLocal(double ang,
Matrix3x2d dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians and store the result in
dest. |
Matrix3x2d |
rotateTo(Vector2dc fromDir,
Vector2dc toDir)
Apply a rotation transformation to this matrix that rotates the given normalized
fromDir direction vector
to point along the normalized toDir. |
Matrix3x2d |
rotateTo(Vector2dc fromDir,
Vector2dc toDir,
Matrix3x2d dest)
Apply a rotation transformation to this matrix that rotates the given normalized
fromDir direction vector
to point along the normalized toDir, and store the result in dest. |
Matrix3x2d |
rotation(double angle)
Set this matrix to a rotation matrix which rotates the given radians.
|
Matrix3x2d |
scale(double xy)
Apply scaling to this matrix by uniformly scaling the two base axes by the given
xyz factor. |
Matrix3x2d |
scale(double x,
double y)
Apply scaling to this matrix by scaling the base axes by the given x and y factors.
|
Matrix3x2d |
scale(double x,
double y,
Matrix3x2d dest)
Apply scaling to this matrix by scaling the unit axes by the given x and y and store the result in
dest. |
Matrix3x2d |
scale(double xy,
Matrix3x2d dest)
Apply scaling to this matrix by uniformly scaling the two base axes by the given
xy factor
and store the result in dest. |
Matrix3x2d |
scale(Vector2dc xy)
Apply scaling to this matrix by scaling the base axes by the given
xy factors. |
Matrix3x2d |
scale(Vector2dc xy,
Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the given
xy factors
and store the result in dest. |
Matrix3x2d |
scale(Vector2fc xy)
Apply scaling to this matrix by scaling the base axes by the given
xy factors. |
Matrix3x2d |
scale(Vector2fc xy,
Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the given
xy factors
and store the result in dest. |
Matrix3x2d |
scaleAround(double factor,
double ox,
double oy)
Apply scaling to this matrix by scaling the base axes by the given
factor
while using (ox, oy) as the scaling origin. |
Matrix3x2d |
scaleAround(double sx,
double sy,
double ox,
double oy)
Apply scaling to this matrix by scaling the base axes by the given sx and
sy factors while using
(ox, oy) as the scaling origin. |
Matrix3x2d |
scaleAround(double sx,
double sy,
double ox,
double oy,
Matrix3x2d dest)
Apply scaling to
this matrix by scaling the base axes by the given sx and
sy factors while using (ox, oy) as the scaling origin, and store the result in dest. |
Matrix3x2d |
scaleAround(double factor,
double ox,
double oy,
Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the given
factor
while using (ox, oy) as the scaling origin,
and store the result in dest. |
Matrix3x2d |
scaleAroundLocal(double factor,
double ox,
double oy)
Pre-multiply scaling to this matrix by scaling the base axes by the given
factor
while using (ox, oy) as the scaling origin. |
Matrix3x2d |
scaleAroundLocal(double sx,
double sy,
double sz,
double ox,
double oy,
double oz)
Pre-multiply scaling to this matrix by scaling the base axes by the given sx and
sy factors while using
(ox, oy) as the scaling origin. |
Matrix3x2d |
scaleAroundLocal(double sx,
double sy,
double ox,
double oy,
Matrix3x2d dest)
Pre-multiply scaling to
this matrix by scaling the base axes by the given sx and
sy factors while using the given (ox, oy) as the scaling origin,
and store the result in dest. |
Matrix3x2d |
scaleAroundLocal(double factor,
double ox,
double oy,
Matrix3x2d dest)
Pre-multiply scaling to this matrix by scaling the base axes by the given
factor
while using (ox, oy) as the scaling origin,
and store the result in dest. |
Matrix3x2d |
scaleLocal(double xy)
Pre-multiply scaling to this matrix by scaling the base axes by the given xy factor.
|
Matrix3x2d |
scaleLocal(double x,
double y)
Pre-multiply scaling to this matrix by scaling the base axes by the given x and y factors.
|
Matrix3x2d |
scaleLocal(double x,
double y,
Matrix3x2d dest)
Pre-multiply scaling to
this matrix by scaling the base axes by the given x and y
factors and store the result in dest. |
Matrix3x2d |
scaleLocal(double xy,
Matrix3x2d dest)
Pre-multiply scaling to
this matrix by scaling the two base axes by the given xy factor,
and store the result in dest. |
Matrix3x2d |
scaling(double factor)
Set this matrix to be a simple scale matrix, which scales the two base axes uniformly by the given factor.
|
Matrix3x2d |
scaling(double x,
double y)
Set this matrix to be a simple scale matrix.
|
Matrix3x2d |
set(ByteBuffer buffer)
Set the values of this matrix by reading 6 double values from the given
ByteBuffer in column-major order,
starting at its current position. |
Matrix3x2d |
set(double[] m)
Set the values in this matrix based on the supplied double array.
|
Matrix3x2d |
set(DoubleBuffer buffer)
Set the values of this matrix by reading 6 double values from the given
DoubleBuffer in column-major order,
starting at its current position. |
Matrix3x2d |
set(double m00,
double m01,
double m10,
double m11,
double m20,
double m21)
Set the values within this matrix to the supplied double values.
|
Matrix3x2d |
set(Matrix2dc m)
Set the left 2x2 submatrix of this
Matrix3x2d to the given Matrix2dc and don't change the other elements. |
Matrix3x2d |
set(Matrix2fc m)
Set the left 2x2 submatrix of this
Matrix3x2d to the given Matrix2fc and don't change the other elements. |
Matrix3x2d |
set(Matrix3x2dc m)
Set the elements of this matrix to the ones in
m. |
Matrix3x2d |
setTranslation(double x,
double y)
Set only the translation components of this matrix
(m20, m21) to the given values (x, y). |
Matrix3x2d |
setTranslation(Vector2dc offset)
Set only the translation components of this matrix
(m20, m21) to the given values (offset.x, offset.y). |
Matrix3x2d |
setView(double left,
double right,
double bottom,
double top)
Set this matrix to define a "view" transformation that maps the given
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively. |
Matrix3x2d |
span(Vector2d corner,
Vector2d xDir,
Vector2d yDir)
Compute the extents of the coordinate system before this transformation was applied and store the resulting
corner coordinates in
corner and the span vectors in xDir and yDir. |
boolean |
testAar(double minX,
double minY,
double maxX,
double maxY)
Test whether the given axis-aligned rectangle is partly or completely within or outside of the frustum defined by
this matrix. |
boolean |
testCircle(double x,
double y,
double r)
Test whether the given circle is partly or completely within or outside of the frustum defined by
this matrix. |
boolean |
testPoint(double x,
double y)
Test whether the given point
(x, y) is within the frustum defined by this matrix. |
String |
toString()
Return a string representation of this matrix.
|
String |
toString(NumberFormat formatter)
Return a string representation of this matrix by formatting the matrix elements with the given
NumberFormat. |
Vector3d |
transform(double x,
double y,
double z,
Vector3d dest)
Transform/multiply the given vector
(x, y, z) by this matrix and store the result in dest. |
Vector3d |
transform(Vector3d v)
Transform/multiply the given vector by this matrix by assuming a third row in this matrix of
(0, 0, 1)
and store the result in that vector. |
Vector3d |
transform(Vector3dc v,
Vector3d dest)
Transform/multiply the given vector by this matrix by assuming a third row in this matrix of
(0, 0, 1)
and store the result in dest. |
Vector2d |
transformDirection(double x,
double y,
Vector2d dest)
Transform/multiply the given 2D-vector
(x, y), as if it was a 3D-vector with z=0, by
this matrix and store the result in dest. |
Vector2d |
transformDirection(Vector2d v)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by
this matrix and store the result in that vector.
|
Vector2d |
transformDirection(Vector2dc v,
Vector2d dest)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by
this matrix and store the result in
dest. |
Vector2d |
transformPosition(double x,
double y,
Vector2d dest)
Transform/multiply the given 2D-vector
(x, y), as if it was a 3D-vector with z=1, by
this matrix and store the result in dest. |
Vector2d |
transformPosition(Vector2d v)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by
this matrix and store the result in that vector.
|
Vector2d |
transformPosition(Vector2dc v,
Vector2d dest)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by
this matrix and store the result in
dest. |
Matrix3x2d |
translate(double x,
double y)
Apply a translation to this matrix by translating by the given number of units in x and y.
|
Matrix3x2d |
translate(double x,
double y,
Matrix3x2d dest)
Apply a translation to this matrix by translating by the given number of units in x and y and store the result
in
dest. |
Matrix3x2d |
translate(Vector2dc offset)
Apply a translation to this matrix by translating by the given number of units in x and y.
|
Matrix3x2d |
translate(Vector2dc offset,
Matrix3x2d dest)
Apply a translation to this matrix by translating by the given number of units in x and y, and
store the result in
dest. |
Matrix3x2d |
translateLocal(double x,
double y)
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y.
|
Matrix3x2d |
translateLocal(double x,
double y,
Matrix3x2d dest)
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y and store the result in
dest. |
Matrix3x2d |
translateLocal(Vector2dc offset)
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y.
|
Matrix3x2d |
translateLocal(Vector2dc offset,
Matrix3x2d dest)
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y and store the result in
dest. |
Matrix3x2d |
translation(double x,
double y)
Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.
|
Matrix3x2d |
translation(Vector2dc offset)
Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.
|
Vector2d |
unproject(double winX,
double winY,
int[] viewport,
Vector2d dest)
Unproject the given window coordinates
(winX, winY) by this matrix using the specified viewport. |
Vector2d |
unprojectInv(double winX,
double winY,
int[] viewport,
Vector2d dest)
Unproject the given window coordinates
(winX, winY) by this matrix using the specified viewport. |
Matrix3x2d |
view(double left,
double right,
double bottom,
double top)
Apply a "view" transformation to this matrix that maps the given
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively. |
Matrix3x2d |
view(double left,
double right,
double bottom,
double top,
Matrix3x2d dest)
Apply a "view" transformation to this matrix that maps the given
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively and store the result in dest. |
double[] |
viewArea(double[] area)
Obtain the extents of the view transformation of
this matrix and store it in area. |
void |
writeExternal(ObjectOutput out) |
Matrix3x2d |
zero()
Set all values within this matrix to zero.
|
public double m00
public double m01
public double m10
public double m11
public double m20
public double m21
public Matrix3x2d()
Matrix3x2d and set it to identity.public Matrix3x2d(Matrix2dc mat)
Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2dc
and the rest to identity.mat - the Matrix2dcpublic Matrix3x2d(Matrix2fc mat)
Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2fc
and the rest to identity.mat - the Matrix2fcpublic Matrix3x2d(Matrix3x2dc mat)
Matrix3x2d and make it a copy of the given matrix.mat - the Matrix3x2dc to copy the values frompublic Matrix3x2d(double m00,
double m01,
double m10,
double m11,
double m20,
double m21)
m00 - the value of m00m01 - the value of m01m10 - the value of m10m11 - the value of m11m20 - the value of m20m21 - the value of m21public Matrix3x2d(DoubleBuffer buffer)
Matrix3x2d by reading its 6 double components from the given DoubleBuffer
at the buffer's current position.
That DoubleBuffer is expected to hold the values in column-major order.
The buffer's position will not be changed by this method.
buffer - the DoubleBuffer to read the matrix values frompublic double m00()
Matrix3x2dcm00 in interface Matrix3x2dcpublic double m01()
Matrix3x2dcm01 in interface Matrix3x2dcpublic double m10()
Matrix3x2dcm10 in interface Matrix3x2dcpublic double m11()
Matrix3x2dcm11 in interface Matrix3x2dcpublic double m20()
Matrix3x2dcm20 in interface Matrix3x2dcpublic double m21()
Matrix3x2dcm21 in interface Matrix3x2dcpublic Matrix3x2d _m00(double m00)
m00 - the new valuepublic Matrix3x2d _m01(double m01)
m01 - the new valuepublic Matrix3x2d _m10(double m10)
m10 - the new valuepublic Matrix3x2d _m11(double m11)
m11 - the new valuepublic Matrix3x2d _m20(double m20)
m20 - the new valuepublic Matrix3x2d _m21(double m21)
m21 - the new valuepublic Matrix3x2d set(Matrix3x2dc m)
m.m - the matrix to copy the elements frompublic Matrix3x2d set(Matrix2dc m)
Matrix3x2d to the given Matrix2dc and don't change the other elements.m - the 2x2 matrixpublic Matrix3x2d set(Matrix2fc m)
Matrix3x2d to the given Matrix2fc and don't change the other elements.m - the 2x2 matrixpublic Matrix3x2d mul(Matrix3x2dc right)
right matrix by assuming a third row in
both matrices of (0, 0, 1).
If M is this matrix and R the right matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
transformation of the right matrix will be applied first!
right - the right operand of the matrix multiplicationpublic Matrix3x2d mul(Matrix3x2dc right, Matrix3x2d dest)
right matrix by assuming a third row in
both matrices of (0, 0, 1) and store the result in dest.
If M is this matrix and R the right matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
transformation of the right matrix will be applied first!
mul in interface Matrix3x2dcright - the right operand of the matrix multiplicationdest - will hold the resultpublic Matrix3x2d mulLocal(Matrix3x2dc left)
left matrix and store the result in this.
If M is this matrix and L the left matrix,
then the new matrix will be L * M. So when transforming a
vector v with the new matrix by using L * M * v, the
transformation of this matrix will be applied first!
left - the left operand of the matrix multiplicationpublic Matrix3x2d mulLocal(Matrix3x2dc left, Matrix3x2d dest)
Matrix3x2dcleft matrix and store the result in dest.
If M is this matrix and L the left matrix,
then the new matrix will be L * M. So when transforming a
vector v with the new matrix by using L * M * v, the
transformation of this matrix will be applied first!
mulLocal in interface Matrix3x2dcleft - the left operand of the matrix multiplicationdest - the destination matrix, which will hold the resultpublic Matrix3x2d set(double m00, double m01, double m10, double m11, double m20, double m21)
m00, m10, m20
m01, m11, m21
m00 - the new value of m00m01 - the new value of m01m10 - the new value of m10m11 - the new value of m11m20 - the new value of m20m21 - the new value of m21public Matrix3x2d set(double[] m)
0, 2, 4
1, 3, 5
This method only uses the first 6 values, all others are ignored.
m - the array to read the matrix values frompublic double determinant()
determinant in interface Matrix3x2dcpublic Matrix3x2d invert()
(0, 0, 1).public Matrix3x2d invert(Matrix3x2d dest)
this matrix by assuming a third row in this matrix of (0, 0, 1)
and store the result in dest.invert in interface Matrix3x2dcdest - will hold the resultpublic Matrix3x2d translation(double x, double y)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.
In order to apply a translation via to an already existing transformation
matrix, use translate() instead.
x - the units to translate in xy - the units to translate in ytranslate(double, double)public Matrix3x2d translation(Vector2dc offset)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.
In order to apply a translation via to an already existing transformation
matrix, use translate() instead.
offset - the translationtranslate(Vector2dc)public Matrix3x2d setTranslation(double x, double y)
(m20, m21) to the given values (x, y).
To build a translation matrix instead, use translation(double, double).
To apply a translation to another matrix, use translate(double, double).
x - the offset to translate in xy - the offset to translate in ytranslation(double, double),
translate(double, double)public Matrix3x2d setTranslation(Vector2dc offset)
(m20, m21) to the given values (offset.x, offset.y).
To build a translation matrix instead, use translation(Vector2dc).
To apply a translation to another matrix, use translate(Vector2dc).
offset - the new translation to settranslation(Vector2dc),
translate(Vector2dc)public Matrix3x2d translate(double x, double y, Matrix3x2d dest)
dest.
If M is this matrix and T the translation
matrix, then the new matrix will be M * T. So when
transforming a vector v with the new matrix by using
M * T * v, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying
it, use translation(double, double).
translate in interface Matrix3x2dcx - the offset to translate in xy - the offset to translate in ydest - will hold the resulttranslation(double, double)public Matrix3x2d translate(double x, double y)
If M is this matrix and T the translation
matrix, then the new matrix will be M * T. So when
transforming a vector v with the new matrix by using
M * T * v, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying
it, use translation(double, double).
x - the offset to translate in xy - the offset to translate in ytranslation(double, double)public Matrix3x2d translate(Vector2dc offset, Matrix3x2d dest)
dest.
If M is this matrix and T the translation
matrix, then the new matrix will be M * T. So when
transforming a vector v with the new matrix by using
M * T * v, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying
it, use translation(Vector2dc).
translate in interface Matrix3x2dcoffset - the offset to translatedest - will hold the resulttranslation(Vector2dc)public Matrix3x2d translate(Vector2dc offset)
If M is this matrix and T the translation
matrix, then the new matrix will be M * T. So when
transforming a vector v with the new matrix by using
M * T * v, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying
it, use translation(Vector2dc).
offset - the offset to translatetranslation(Vector2dc)public Matrix3x2d translateLocal(Vector2dc offset)
If M is this matrix and T the translation
matrix, then the new matrix will be T * M. So when
transforming a vector v with the new matrix by using
T * M * v, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying
it, use translation(Vector2dc).
offset - the number of units in x and y by which to translatetranslation(Vector2dc)public Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest)
dest.
If M is this matrix and T the translation
matrix, then the new matrix will be T * M. So when
transforming a vector v with the new matrix by using
T * M * v, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying
it, use translation(Vector2dc).
translateLocal in interface Matrix3x2dcoffset - the number of units in x and y by which to translatedest - will hold the resulttranslation(Vector2dc)public Matrix3x2d translateLocal(double x, double y, Matrix3x2d dest)
dest.
If M is this matrix and T the translation
matrix, then the new matrix will be T * M. So when
transforming a vector v with the new matrix by using
T * M * v, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying
it, use translation(double, double).
translateLocal in interface Matrix3x2dcx - the offset to translate in xy - the offset to translate in ydest - will hold the resulttranslation(double, double)public Matrix3x2d translateLocal(double x, double y)
If M is this matrix and T the translation
matrix, then the new matrix will be T * M. So when
transforming a vector v with the new matrix by using
T * M * v, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying
it, use translation(double, double).
x - the offset to translate in xy - the offset to translate in ytranslation(double, double)public String toString()
This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the matrix values withpublic Matrix3x2d get(Matrix3x2d dest)
this matrix and store them into
dest.
This is the reverse method of set(Matrix3x2dc) and allows to obtain
intermediate calculation results when chaining multiple transformations.
get in interface Matrix3x2dcdest - the destination matrixset(Matrix3x2dc)public DoubleBuffer get(DoubleBuffer buffer)
DoubleBuffer at the current
buffer position.
This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which
the matrix is stored, use get(int, DoubleBuffer), taking
the absolute position as parameter.
get in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget(int, DoubleBuffer)public DoubleBuffer get(int index, DoubleBuffer buffer)
DoubleBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given DoubleBuffer.
get in interface Matrix3x2dcindex - the absolute position into the DoubleBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer get(ByteBuffer buffer)
ByteBuffer at the current
buffer position.
This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which
the matrix is stored, use get(int, ByteBuffer), taking
the absolute position as parameter.
get in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
get in interface Matrix3x2dcindex - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic DoubleBuffer get3x3(DoubleBuffer buffer)
DoubleBuffer at the current
buffer position.
This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which
the matrix is stored, use get3x3(int, DoubleBuffer), taking
the absolute position as parameter.
get3x3 in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget3x3(int, DoubleBuffer)public DoubleBuffer get3x3(int index, DoubleBuffer buffer)
DoubleBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given DoubleBuffer.
get3x3 in interface Matrix3x2dcindex - the absolute position into the DoubleBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer get3x3(ByteBuffer buffer)
ByteBuffer at the current
buffer position.
This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which
the matrix is stored, use get3x3(int, ByteBuffer), taking
the absolute position as parameter.
get3x3 in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget3x3(int, ByteBuffer)public ByteBuffer get3x3(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
get3x3 in interface Matrix3x2dcindex - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic DoubleBuffer get4x4(DoubleBuffer buffer)
DoubleBuffer at the current
buffer position.
This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which
the matrix is stored, use get4x4(int, DoubleBuffer), taking
the absolute position as parameter.
get4x4 in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget4x4(int, DoubleBuffer)public DoubleBuffer get4x4(int index, DoubleBuffer buffer)
DoubleBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given DoubleBuffer.
get4x4 in interface Matrix3x2dcindex - the absolute position into the DoubleBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer get4x4(ByteBuffer buffer)
ByteBuffer at the current
buffer position.
This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which
the matrix is stored, use get4x4(int, ByteBuffer), taking
the absolute position as parameter.
get4x4 in interface Matrix3x2dcbuffer - will receive the values of this matrix in column-major order at its current positionget4x4(int, ByteBuffer)public ByteBuffer get4x4(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
get4x4 in interface Matrix3x2dcindex - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic double[] get(double[] arr,
int offset)
get in interface Matrix3x2dcarr - the array to write the matrix values intooffset - the offset into the arraypublic double[] get(double[] arr)
In order to specify an explicit offset into the array, use the method get(double[], int).
get in interface Matrix3x2dcarr - the array to write the matrix values intoget(double[], int)public double[] get3x3(double[] arr,
int offset)
get3x3 in interface Matrix3x2dcarr - the array to write the matrix values intooffset - the offset into the arraypublic double[] get3x3(double[] arr)
In order to specify an explicit offset into the array, use the method get3x3(double[], int).
get3x3 in interface Matrix3x2dcarr - the array to write the matrix values intoget3x3(double[], int)public double[] get4x4(double[] arr,
int offset)
get4x4 in interface Matrix3x2dcarr - the array to write the matrix values intooffset - the offset into the arraypublic double[] get4x4(double[] arr)
In order to specify an explicit offset into the array, use the method get4x4(double[], int).
get4x4 in interface Matrix3x2dcarr - the array to write the matrix values intoget4x4(double[], int)public Matrix3x2d set(DoubleBuffer buffer)
DoubleBuffer in column-major order,
starting at its current position.
The DoubleBuffer is expected to contain the values in column-major order.
The position of the DoubleBuffer will not be changed by this method.
buffer - the DoubleBuffer to read the matrix values from in column-major orderpublic Matrix3x2d set(ByteBuffer buffer)
ByteBuffer in column-major order,
starting at its current position.
The ByteBuffer is expected to contain the values in column-major order.
The position of the ByteBuffer will not be changed by this method.
buffer - the ByteBuffer to read the matrix values from in column-major orderpublic Matrix3x2d zero()
public Matrix3x2d identity()
public Matrix3x2d scale(double x, double y, Matrix3x2d dest)
dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
scale in interface Matrix3x2dcx - the factor of the x componenty - the factor of the y componentdest - will hold the resultpublic Matrix3x2d scale(double x, double y)
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
x - the factor of the x componenty - the factor of the y componentpublic Matrix3x2d scale(Vector2dc xy)
xy factors.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
xy - the factors of the x and y component, respectivelypublic Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest)
xy factors
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
scale in interface Matrix3x2dcxy - the factors of the x and y component, respectivelydest - will hold the resultpublic Matrix3x2d scale(Vector2fc xy)
xy factors.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
xy - the factors of the x and y component, respectivelypublic Matrix3x2d scale(Vector2fc xy, Matrix3x2d dest)
xy factors
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
scale in interface Matrix3x2dcxy - the factors of the x and y component, respectivelydest - will hold the resultpublic Matrix3x2d scale(double xy, Matrix3x2d dest)
xy factor
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
scale in interface Matrix3x2dcxy - the factor for the two componentsdest - will hold the resultscale(double, double, Matrix3x2d)public Matrix3x2d scale(double xy)
xyz factor.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the scaling will be applied first!
xy - the factor for the two componentsscale(double, double)public Matrix3x2d scaleLocal(double x, double y, Matrix3x2d dest)
Matrix3x2dcthis matrix by scaling the base axes by the given x and y
factors and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v
, the scaling will be applied last!
scaleLocal in interface Matrix3x2dcx - the factor of the x componenty - the factor of the y componentdest - will hold the resultpublic Matrix3x2d scaleLocal(double x, double y)
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
x - the factor of the x componenty - the factor of the y componentpublic Matrix3x2d scaleLocal(double xy, Matrix3x2d dest)
Matrix3x2dcthis matrix by scaling the two base axes by the given xy factor,
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v
, the scaling will be applied last!
scaleLocal in interface Matrix3x2dcxy - the factor to scale all two base axes bydest - will hold the resultpublic Matrix3x2d scaleLocal(double xy)
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
xy - the factor of the x and y componentpublic Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest)
this matrix by scaling the base axes by the given sx and
sy factors while using (ox, oy) as the scaling origin, and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
This method is equivalent to calling: translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)
scaleAround in interface Matrix3x2dcsx - the scaling factor of the x componentsy - the scaling factor of the y componentox - the x coordinate of the scaling originoy - the y coordinate of the scaling origindest - will hold the resultpublic Matrix3x2d scaleAround(double sx, double sy, double ox, double oy)
(ox, oy) as the scaling origin.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the
scaling will be applied first!
This method is equivalent to calling: translate(ox, oy).scale(sx, sy).translate(-ox, -oy)
sx - the scaling factor of the x componentsy - the scaling factor of the y componentox - the x coordinate of the scaling originoy - the y coordinate of the scaling originpublic Matrix3x2d scaleAround(double factor, double ox, double oy, Matrix3x2d dest)
factor
while using (ox, oy) as the scaling origin,
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the
scaling will be applied first!
This method is equivalent to calling: translate(ox, oy, dest).scale(factor).translate(-ox, -oy)
scaleAround in interface Matrix3x2dcfactor - the scaling factor for all three axesox - the x coordinate of the scaling originoy - the y coordinate of the scaling origindest - will hold the resultpublic Matrix3x2d scaleAround(double factor, double ox, double oy)
factor
while using (ox, oy) as the scaling origin.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the
scaling will be applied first!
This method is equivalent to calling: translate(ox, oy).scale(factor).translate(-ox, -oy)
factor - the scaling factor for all axesox - the x coordinate of the scaling originoy - the y coordinate of the scaling originpublic Matrix3x2d scaleAroundLocal(double sx, double sy, double ox, double oy, Matrix3x2d dest)
Matrix3x2dcthis matrix by scaling the base axes by the given sx and
sy factors while using the given (ox, oy) as the scaling origin,
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v
, the scaling will be applied last!
This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, dest)
scaleAroundLocal in interface Matrix3x2dcsx - the scaling factor of the x componentsy - the scaling factor of the y componentox - the x coordinate of the scaling originoy - the y coordinate of the scaling origindest - will hold the resultpublic Matrix3x2d scaleAroundLocal(double factor, double ox, double oy, Matrix3x2d dest)
Matrix3x2dcfactor
while using (ox, oy) as the scaling origin,
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(factor).translate(-ox, -oy).mul(this, dest)
scaleAroundLocal in interface Matrix3x2dcfactor - the scaling factor for all three axesox - the x coordinate of the scaling originoy - the y coordinate of the scaling origindest - will hold the resultpublic Matrix3x2d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz)
(ox, oy) as the scaling origin.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, this)
sx - the scaling factor of the x componentsy - the scaling factor of the y componentsz - the scaling factor of the z componentox - the x coordinate of the scaling originoy - the y coordinate of the scaling originoz - the z coordinate of the scaling originpublic Matrix3x2d scaleAroundLocal(double factor, double ox, double oy)
factor
while using (ox, oy) as the scaling origin.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(factor).translate(-ox, -oy).mul(this, this)
factor - the scaling factor for all three axesox - the x coordinate of the scaling originoy - the y coordinate of the scaling originpublic Matrix3x2d scaling(double factor)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.
In order to post-multiply a scaling transformation directly to a matrix, use scale() instead.
factor - the scale factor in x and yscale(double)public Matrix3x2d scaling(double x, double y)
x - the scale in xy - the scale in ypublic Matrix3x2d rotation(double angle)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation,
use rotate() instead.
angle - the angle in radiansrotate(double)public Vector3d transform(Vector3d v)
(0, 0, 1)
and store the result in that vector.transform in interface Matrix3x2dcv - the vector to transform and to hold the final resultVector3d.mul(Matrix3x2dc)public Vector3d transform(Vector3dc v, Vector3d dest)
(0, 0, 1)
and store the result in dest.transform in interface Matrix3x2dcv - the vector to transformdest - will contain the resultVector3d.mul(Matrix3x2dc, Vector3d)public Vector3d transform(double x, double y, double z, Vector3d dest)
(x, y, z) by this matrix and store the result in dest.transform in interface Matrix3x2dcx - the x component of the vector to transformy - the y component of the vector to transformz - the z component of the vector to transformdest - will contain the resultpublic Vector2d transformPosition(Vector2d v)
The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in another vector, use transformPosition(Vector2dc, Vector2d).
transformPosition in interface Matrix3x2dcv - the vector to transform and to hold the final resulttransformPosition(Vector2dc, Vector2d),
transform(Vector3d)public Vector2d transformPosition(Vector2dc v, Vector2d dest)
dest.
The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in the same vector, use transformPosition(Vector2d).
transformPosition in interface Matrix3x2dcv - the vector to transformdest - will hold the resulttransformPosition(Vector2d),
transform(Vector3dc, Vector3d)public Vector2d transformPosition(double x, double y, Vector2d dest)
(x, y), as if it was a 3D-vector with z=1, by
this matrix and store the result in dest.
The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in the same vector, use transformPosition(Vector2d).
transformPosition in interface Matrix3x2dcx - the x component of the vector to transformy - the y component of the vector to transformdest - will hold the resulttransformPosition(Vector2d),
transform(Vector3dc, Vector3d)public Vector2d transformDirection(Vector2d v)
The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it
will represent a direction in 2D-space rather than a position. This method will therefore
not take the translation part of the matrix into account.
In order to store the result in another vector, use transformDirection(Vector2dc, Vector2d).
transformDirection in interface Matrix3x2dcv - the vector to transform and to hold the final resulttransformDirection(Vector2dc, Vector2d)public Vector2d transformDirection(Vector2dc v, Vector2d dest)
dest.
The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it
will represent a direction in 2D-space rather than a position. This method will therefore
not take the translation part of the matrix into account.
In order to store the result in the same vector, use transformDirection(Vector2d).
transformDirection in interface Matrix3x2dcv - the vector to transform and to hold the final resultdest - will hold the resulttransformDirection(Vector2d)public Vector2d transformDirection(double x, double y, Vector2d dest)
(x, y), as if it was a 3D-vector with z=0, by
this matrix and store the result in dest.
The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it
will represent a direction in 2D-space rather than a position. This method will therefore
not take the translation part of the matrix into account.
In order to store the result in the same vector, use transformDirection(Vector2d).
transformDirection in interface Matrix3x2dcx - the x component of the vector to transformy - the y component of the vector to transformdest - will hold the resulttransformDirection(Vector2d)public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException
readExternal in interface ExternalizableIOExceptionpublic Matrix3x2d rotate(double ang)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
ang - the angle in radianspublic Matrix3x2d rotate(double ang, Matrix3x2d dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the rotation will be applied first!
rotate in interface Matrix3x2dcang - the angle in radiansdest - will hold the resultpublic Matrix3x2d rotateLocal(double ang, Matrix3x2d dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be R * M. So when transforming a
vector v with the new matrix by using R * M * v, the
rotation will be applied last!
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use rotation().
Reference: http://en.wikipedia.org
rotateLocal in interface Matrix3x2dcang - the angle in radians to rotatedest - will hold the resultrotation(double)public Matrix3x2d rotateLocal(double ang)
If M is this matrix and R the rotation matrix,
then the new matrix will be R * M. So when transforming a
vector v with the new matrix by using R * M * v, the
rotation will be applied last!
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use rotation().
Reference: http://en.wikipedia.org
ang - the angle in radians to rotaterotation(double)public Matrix3x2d rotateAbout(double ang, double x, double y)
(x, y).
This method is equivalent to calling: translate(x, y).rotate(ang).translate(-x, -y)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the rotation will be applied first!
ang - the angle in radiansx - the x component of the rotation centery - the y component of the rotation centertranslate(double, double),
rotate(double)public Matrix3x2d rotateAbout(double ang, double x, double y, Matrix3x2d dest)
(x, y) and store the result in dest.
This method is equivalent to calling: translate(x, y, dest).rotate(ang).translate(-x, -y)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the rotation will be applied first!
rotateAbout in interface Matrix3x2dcang - the angle in radiansx - the x component of the rotation centery - the y component of the rotation centerdest - will hold the resulttranslate(double, double, Matrix3x2d),
rotate(double, Matrix3x2d)public Matrix3x2d rotateTo(Vector2dc fromDir, Vector2dc toDir, Matrix3x2d dest)
fromDir direction vector
to point along the normalized toDir, and store the result in dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the rotation will be applied first!
rotateTo in interface Matrix3x2dcfromDir - the normalized direction which should be rotate to point along toDirtoDir - the normalized destination directiondest - will hold the resultpublic Matrix3x2d rotateTo(Vector2dc fromDir, Vector2dc toDir)
fromDir direction vector
to point along the normalized toDir.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the rotation will be applied first!
fromDir - the normalized direction which should be rotate to point along toDirtoDir - the normalized destination directionpublic Matrix3x2d view(double left, double right, double bottom, double top, Matrix3x2d dest)
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively and store the result in dest.
If M is this matrix and O the orthographic projection matrix,
then the new matrix will be M * O. So when transforming a
vector v with the new matrix by using M * O * v, the
orthographic projection transformation will be applied first!
view in interface Matrix3x2dcleft - the distance from the center to the left view edgeright - the distance from the center to the right view edgebottom - the distance from the center to the bottom view edgetop - the distance from the center to the top view edgedest - will hold the resultsetView(double, double, double, double)public Matrix3x2d view(double left, double right, double bottom, double top)
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively.
If M is this matrix and O the orthographic projection matrix,
then the new matrix will be M * O. So when transforming a
vector v with the new matrix by using M * O * v, the
orthographic projection transformation will be applied first!
left - the distance from the center to the left view edgeright - the distance from the center to the right view edgebottom - the distance from the center to the bottom view edgetop - the distance from the center to the top view edgesetView(double, double, double, double)public Matrix3x2d setView(double left, double right, double bottom, double top)
(left, bottom) and
(right, top) corners to (-1, -1) and (1, 1) respectively.left - the distance from the center to the left view edgeright - the distance from the center to the right view edgebottom - the distance from the center to the bottom view edgetop - the distance from the center to the top view edgeview(double, double, double, double)public Vector2d origin(Vector2d origin)
this matrix.
This can be used to get the position of the "camera" from a given view transformation matrix.
This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invert(); inv.transform(origin.set(0, 0));
origin in interface Matrix3x2dcorigin - will hold the position transformed to the originpublic double[] viewArea(double[] area)
this matrix and store it in area.
This can be used to determine which region of the screen (i.e. the NDC space) is covered by the view.viewArea in interface Matrix3x2dcarea - will hold the view area as [minX, minY, maxX, maxY]public Vector2d positiveX(Vector2d dir)
Matrix3x2dc+X before the transformation represented by this matrix is applied.
This method uses the rotation component of the left 2x2 submatrix to obtain the direction
that is transformed to +X by this matrix.
This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invert(); inv.transformDirection(dir.set(1, 0)).normalize();If
this is already an orthogonal matrix, then consider using Matrix3x2dc.normalizedPositiveX(Vector2d) instead.
Reference: http://www.euclideanspace.com
positiveX in interface Matrix3x2dcdir - will hold the direction of +Xpublic Vector2d normalizedPositiveX(Vector2d dir)
Matrix3x2dc+X before the transformation represented by this orthogonal matrix is applied.
This method only produces correct results if this is an orthogonal matrix.
This method uses the rotation component of the left 2x2 submatrix to obtain the direction
that is transformed to +X by this matrix.
This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).transpose(); inv.transformDirection(dir.set(1, 0));
Reference: http://www.euclideanspace.com
normalizedPositiveX in interface Matrix3x2dcdir - will hold the direction of +Xpublic Vector2d positiveY(Vector2d dir)
Matrix3x2dc+Y before the transformation represented by this matrix is applied.
This method uses the rotation component of the left 2x2 submatrix to obtain the direction
that is transformed to +Y by this matrix.
This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invert(); inv.transformDirection(dir.set(0, 1)).normalize();If
this is already an orthogonal matrix, then consider using Matrix3x2dc.normalizedPositiveY(Vector2d) instead.
Reference: http://www.euclideanspace.com
positiveY in interface Matrix3x2dcdir - will hold the direction of +Ypublic Vector2d normalizedPositiveY(Vector2d dir)
Matrix3x2dc+Y before the transformation represented by this orthogonal matrix is applied.
This method only produces correct results if this is an orthogonal matrix.
This method uses the rotation component of the left 2x2 submatrix to obtain the direction
that is transformed to +Y by this matrix.
This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).transpose(); inv.transformDirection(dir.set(0, 1));
Reference: http://www.euclideanspace.com
normalizedPositiveY in interface Matrix3x2dcdir - will hold the direction of +Ypublic Vector2d unproject(double winX, double winY, int[] viewport, Vector2d dest)
(winX, winY) by this matrix using the specified viewport.
This method first converts the given window coordinates to normalized device coordinates in the range [-1..1]
and then transforms those NDC coordinates by the inverse of this matrix.
As a necessary computation step for unprojecting, this method computes the inverse of this matrix.
In order to avoid computing the matrix inverse with every invocation, the inverse of this matrix can be built
once outside using invert(Matrix3x2d) and then the method unprojectInv() can be invoked on it.
unproject in interface Matrix3x2dcwinX - the x-coordinate in window coordinates (pixels)winY - the y-coordinate in window coordinates (pixels)viewport - the viewport described by [x, y, width, height]dest - will hold the unprojected positionunprojectInv(double, double, int[], Vector2d),
invert(Matrix3x2d)public Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest)
(winX, winY) by this matrix using the specified viewport.
This method differs from unproject()
in that it assumes that this is already the inverse matrix of the original projection matrix.
It exists to avoid recomputing the matrix inverse with every invocation.
unprojectInv in interface Matrix3x2dcwinX - the x-coordinate in window coordinates (pixels)winY - the y-coordinate in window coordinates (pixels)viewport - the viewport described by [x, y, width, height]dest - will hold the unprojected positionunproject(double, double, int[], Vector2d)public Matrix3x2d span(Vector2d corner, Vector2d xDir, Vector2d yDir)
corner and the span vectors in xDir and yDir.
That means, given the maximum extents of the coordinate system between [-1..+1] in all dimensions,
this method returns one corner and the length and direction of the two base axis vectors in the coordinate
system before this transformation is applied, which transforms into the corner coordinates [-1, +1].
corner - will hold one corner of the spanxDir - will hold the direction and length of the span along the positive X axisyDir - will hold the direction and length of the span along the positive Y axispublic boolean testPoint(double x,
double y)
Matrix3x2dc(x, y) is within the frustum defined by this matrix.
This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M
into standard OpenGL clip space and tests whether the given point with the coordinates (x, y, z) given
in space M is within the clip space.
Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
testPoint in interface Matrix3x2dcx - the x-coordinate of the pointy - the y-coordinate of the pointtrue if the given point is inside the frustum; false otherwisepublic boolean testCircle(double x,
double y,
double r)
Matrix3x2dcthis matrix.
This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M
into standard OpenGL clip space and tests whether the given sphere with the coordinates (x, y, z) given
in space M is within the clip space.
Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
testCircle in interface Matrix3x2dcx - the x-coordinate of the circle's centery - the y-coordinate of the circle's centerr - the circle's radiustrue if the given circle is partly or completely inside the frustum; false otherwisepublic boolean testAar(double minX,
double minY,
double maxX,
double maxY)
Matrix3x2dcthis matrix.
The rectangle is specified via its min and max corner coordinates.
This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M
into standard OpenGL clip space and tests whether the given axis-aligned rectangle with its minimum corner coordinates (minX, minY, minZ)
and maximum corner coordinates (maxX, maxY, maxZ) given in space M is within the clip space.
Reference: Efficient View Frustum Culling
Reference:
Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
testAar in interface Matrix3x2dcminX - the x-coordinate of the minimum cornerminY - the y-coordinate of the minimum cornermaxX - the x-coordinate of the maximum cornermaxY - the y-coordinate of the maximum cornertrue if the axis-aligned box is completely or partly inside of the frustum; false otherwisepublic boolean equals(Matrix3x2dc m, double delta)
Matrix3x2dcthis matrix with the given matrix using the given delta
and return whether all of them are equal within a maximum difference of delta.
Please note that this method is not used by any data structure such as ArrayList HashSet or HashMap
and their operations, such as ArrayList.contains(Object) or HashSet.remove(Object), since those
data structures only use the Object.equals(Object) and Object.hashCode() methods.
equals in interface Matrix3x2dcm - the other matrixdelta - the allowed maximum differencetrue whether all of the matrix elements are equal; false otherwiseCopyright © 2015–2019 JOML. All rights reserved.