public interface Matrix2dc
| Modifier and Type | Method and Description |
|---|---|
Matrix2d |
add(Matrix2dc other,
Matrix2d dest)
Component-wise add
this and other and store the result in dest. |
double |
determinant()
Return the determinant of this matrix.
|
boolean |
equals(Matrix2dc 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. |
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. |
double |
get(int column,
int row)
Get the matrix element value at the given column and row.
|
Matrix2d |
get(Matrix2d dest)
Get the current values of
this matrix and store them into
dest. |
Matrix3d |
get(Matrix3d dest)
Get the current values of
this matrix and store them as
the rotational component of dest. |
Matrix3x2d |
get(Matrix3x2d dest)
Get the current values of
this matrix and store them as
the rotational component of dest. |
Vector2d |
getColumn(int column,
Vector2d dest)
Get the column at the given
column index, starting with 0. |
double |
getRotation()
Get the angle of the rotation component of
this matrix. |
Vector2d |
getRow(int row,
Vector2d dest)
Get the row at the given
row index, starting with 0. |
Vector2d |
getScale(Vector2d dest)
Get the scaling factors of
this matrix for the three base axes. |
ByteBuffer |
getTransposed(ByteBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
DoubleBuffer |
getTransposed(DoubleBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
DoubleBuffer at the current
buffer position. |
ByteBuffer |
getTransposed(int index,
ByteBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
DoubleBuffer |
getTransposed(int index,
DoubleBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
DoubleBuffer starting at the specified
absolute buffer position/index. |
Matrix2d |
invert(Matrix2d dest)
Invert the
this matrix and store the result in dest. |
Matrix2d |
lerp(Matrix2dc other,
double t,
Matrix2d dest)
Linearly interpolate
this and other using the given interpolation factor t
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.
|
Matrix2d |
mul(Matrix2dc right,
Matrix2d dest)
Multiply this matrix by the supplied
right matrix and store the result in dest. |
Matrix2d |
mul(Matrix2fc right,
Matrix2d dest)
Multiply this matrix by the supplied
right matrix and store the result in dest. |
Matrix2d |
mulComponentWise(Matrix2dc other,
Matrix2d dest)
Component-wise multiply
this by other and store the result in dest. |
Matrix2d |
mulLocal(Matrix2dc left,
Matrix2d dest)
Pre-multiply this matrix by the supplied
left matrix and store the result in dest. |
Matrix2d |
normal(Matrix2d dest)
Compute a normal matrix from
this matrix and store it into dest. |
Vector2d |
normalizedPositiveX(Vector2d dest)
Obtain the direction of
+X before the transformation represented by this orthogonal matrix is applied. |
Vector2d |
normalizedPositiveY(Vector2d dest)
Obtain the direction of
+Y before the transformation represented by this orthogonal matrix is applied. |
Vector2d |
positiveX(Vector2d dest)
Obtain the direction of
+X before the transformation represented by this matrix is applied. |
Vector2d |
positiveY(Vector2d dest)
Obtain the direction of
+Y before the transformation represented by this matrix is applied. |
Matrix2d |
rotate(double ang,
Matrix2d dest)
Apply rotation to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix2d |
rotateLocal(double ang,
Matrix2d dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix2d |
scale(double x,
double y,
Matrix2d dest)
Apply scaling to this matrix by scaling the base axes by the given x and
y factors and store the result in
dest. |
Matrix2d |
scale(double xy,
Matrix2d dest)
Apply scaling to this matrix by uniformly scaling all base axes by the given
xy factor
and store the result in dest. |
Matrix2d |
scale(Vector2dc xy,
Matrix2d dest)
Apply scaling to
this matrix by scaling the base axes by the given xy.x and
xy.y factors, respectively and store the result in dest. |
Matrix2d |
scaleLocal(double x,
double y,
Matrix2d 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. |
Matrix2d |
sub(Matrix2dc subtrahend,
Matrix2d dest)
Component-wise subtract
subtrahend from this and store the result in dest. |
Vector2d |
transform(double x,
double y,
Vector2d dest)
Transform the vector
(x, y) by this matrix and store the result in dest. |
Vector2d |
transform(Vector2d v)
Transform the given vector by this matrix.
|
Vector2d |
transform(Vector2dc v,
Vector2d dest)
Transform the given vector by this matrix and store the result in
dest. |
Vector2d |
transformTranspose(double x,
double y,
Vector2d dest)
Transform the vector
(x, y) by the transpose of this matrix and store the result in dest. |
Vector2d |
transformTranspose(Vector2d v)
Transform the given vector by the transpose of this matrix.
|
Vector2d |
transformTranspose(Vector2dc v,
Vector2d dest)
Transform the given vector by the transpose of this matrix and store the result in
dest. |
Matrix2d |
transpose(Matrix2d dest)
Transpose
this matrix and store the result in dest. |
double m00()
double m01()
double m10()
double m11()
Matrix2d mul(Matrix2dc right, Matrix2d dest)
right matrix 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!
right - the right operand of the matrix multiplicationdest - will hold the resultMatrix2d mul(Matrix2fc right, Matrix2d dest)
right matrix 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!
right - the right operand of the matrix multiplicationdest - will hold the resultMatrix2d mulLocal(Matrix2dc left, Matrix2d dest)
left 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!
left - the left operand of the matrix multiplicationdest - the destination matrix, which will hold the resultdouble determinant()
Matrix2d invert(Matrix2d dest)
this matrix and store the result in dest.dest - will hold the resultMatrix2d transpose(Matrix2d dest)
this matrix and store the result in dest.dest - will hold the resultMatrix2d get(Matrix2d dest)
this matrix and store them into
dest.dest - the destination matrixMatrix3x2d get(Matrix3x2d dest)
this matrix and store them as
the rotational component of dest. All other values of dest will
be set to 0.dest - the destination matrixMatrix3x2d.set(Matrix2dc)Matrix3d get(Matrix3d dest)
this matrix and store them as
the rotational component of dest. All other values of dest will
be set to identity.dest - the destination matrixMatrix3d.set(Matrix2dc)double getRotation()
this matrix.
This method assumes that there is a valid rotation to be returned, i.e. that
atan2(-m10, m00) == atan2(m01, m11).
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.
buffer - will receive the values of this matrix in column-major order at its current positionget(int, DoubleBuffer)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.
index - the absolute position into the DoubleBufferbuffer - will receive the values of this matrix in column-major orderByteBuffer 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.
buffer - will receive the values of this matrix in column-major order at its current positionget(int, ByteBuffer)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.
index - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderDoubleBuffer getTransposed(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 getTransposed(int, DoubleBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positiongetTransposed(int, DoubleBuffer)DoubleBuffer getTransposed(int index, DoubleBuffer buffer)
DoubleBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given DoubleBuffer.
index - the absolute position into the DoubleBufferbuffer - will receive the values of this matrix in column-major orderByteBuffer getTransposed(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 getTransposed(int, ByteBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positiongetTransposed(int, ByteBuffer)ByteBuffer getTransposed(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
index - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderdouble[] get(double[] arr,
int offset)
arr - the array to write the matrix values intooffset - the offset into the arraydouble[] get(double[] arr)
In order to specify an explicit offset into the array, use the method get(double[], int).
arr - the array to write the matrix values intoget(double[], int)Matrix2d scale(Vector2dc xy, Matrix2d dest)
this matrix by scaling the base axes by the given xy.x and
xy.y factors, respectively 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!
xy - the factors of the x and y component, respectivelydest - will hold the resultMatrix2d scale(double x, double y, Matrix2d 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!
x - the factor of the x componenty - the factor of the y componentdest - will hold the resultMatrix2d scale(double xy, Matrix2d 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!
xy - the factor for all componentsdest - will hold the resultscale(double, double, Matrix2d)Matrix2d scaleLocal(double x, double y, Matrix2d dest)
this 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!
x - the factor of the x componenty - the factor of the y componentdest - will hold the resultVector2d transform(Vector2d v)
v - the vector to transformVector2d transform(Vector2dc v, Vector2d dest)
dest.v - the vector to transformdest - will hold the resultVector2d transform(double x, double y, Vector2d dest)
(x, y) by this matrix and store the result in dest.x - the x coordinate of the vector to transformy - the y coordinate of the vector to transformdest - will hold the resultVector2d transformTranspose(Vector2d v)
v - the vector to transformVector2d transformTranspose(Vector2dc v, Vector2d dest)
dest.v - the vector to transformdest - will hold the resultVector2d transformTranspose(double x, double y, Vector2d dest)
(x, y) by the transpose of this matrix and store the result in dest.x - the x coordinate of the vector to transformy - the y coordinate of the vector to transformdest - will hold the resultMatrix2d rotate(double ang, Matrix2d dest)
dest.
The produced rotation will rotate a vector counter-clockwise around the origin.
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!
Reference: http://en.wikipedia.org
ang - the angle in radiansdest - will hold the resultMatrix2d rotateLocal(double ang, Matrix2d dest)
dest.
The produced rotation will rotate a vector counter-clockwise around the origin.
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!
Reference: http://en.wikipedia.org
ang - the angle in radiansdest - will hold the resultVector2d getRow(int row, Vector2d dest) throws IndexOutOfBoundsException
row index, starting with 0.row - the row index in [0..1]dest - will hold the row componentsIndexOutOfBoundsException - if row is not in [0..1]Vector2d getColumn(int column, Vector2d dest) throws IndexOutOfBoundsException
column index, starting with 0.column - the column index in [0..1]dest - will hold the column componentsIndexOutOfBoundsException - if column is not in [0..1]double get(int column,
int row)
column - the colum index in [0..1]row - the row index in [0..1]Matrix2d normal(Matrix2d dest)
this matrix and store it into dest.dest - will hold the resultVector2d getScale(Vector2d dest)
this matrix for the three base axes.dest - will hold the scaling factors for x and yVector2d positiveX(Vector2d dest)
+X before the transformation represented by this matrix is applied.
This method is equivalent to the following code:
Matrix2d inv = new Matrix2d(this).invert(); inv.transform(dir.set(1, 0)).normalize();If
this is already an orthogonal matrix, then consider using normalizedPositiveX(Vector2d) instead.dest - will hold the direction of +XVector2d normalizedPositiveX(Vector2d dest)
+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 is equivalent to the following code:
Matrix2d inv = new Matrix2d(this).transpose(); inv.transform(dir.set(1, 0));
dest - will hold the direction of +XVector2d positiveY(Vector2d dest)
+Y before the transformation represented by this matrix is applied.
This method is equivalent to the following code:
Matrix2d inv = new Matrix2d(this).invert(); inv.transform(dir.set(0, 1)).normalize();If
this is already an orthogonal matrix, then consider using normalizedPositiveY(Vector2d) instead.dest - will hold the direction of +YVector2d normalizedPositiveY(Vector2d dest)
+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 is equivalent to the following code:
Matrix2d inv = new Matrix2d(this).transpose(); inv.transform(dir.set(0, 1));
dest - will hold the direction of +YMatrix2d add(Matrix2dc other, Matrix2d dest)
this and other and store the result in dest.other - the other addenddest - will hold the resultMatrix2d sub(Matrix2dc subtrahend, Matrix2d dest)
subtrahend from this and store the result in dest.subtrahend - the subtrahenddest - will hold the resultMatrix2d mulComponentWise(Matrix2dc other, Matrix2d dest)
this by other and store the result in dest.other - the other matrixdest - will hold the resultMatrix2d lerp(Matrix2dc other, double t, Matrix2d dest)
this and other using the given interpolation factor t
and store the result in dest.
If t is 0.0 then the result is this. If the interpolation factor is 1.0
then the result is other.
other - the other matrixt - the interpolation factor between 0.0 and 1.0dest - will hold the resultboolean equals(Matrix2dc m, double delta)
this 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.
m - the other matrixdelta - the allowed maximum differencetrue whether all of the matrix elements are equal; false otherwiseCopyright © 2015–2019 JOML. All rights reserved.