public class Matrix2f extends Object implements Externalizable, Matrix2fc
m00 m10
m01 m11
| Modifier and Type | Field and Description |
|---|---|
float |
m00 |
float |
m01 |
float |
m10 |
float |
m11 |
| Constructor and Description |
|---|
Matrix2f()
|
Matrix2f(FloatBuffer buffer)
Create a new
Matrix2f by reading its 4 float components from the given FloatBuffer
at the buffer's current position. |
Matrix2f(float m00,
float m01,
float m10,
float m11)
Create a new 2x2 matrix using the supplied float values.
|
Matrix2f(Matrix2fc mat)
Create a new
Matrix2f and make it a copy of the given matrix. |
Matrix2f(Matrix3fc mat)
|
Matrix2f(Vector2fc col0,
Vector2fc col1)
Create a new
Matrix2f and initialize its two columns using the supplied vectors. |
| Modifier and Type | Method and Description |
|---|---|
Matrix2f |
_m00(float m00)
Set the value of the matrix element at column 0 and row 0.
|
Matrix2f |
_m01(float m01)
Set the value of the matrix element at column 0 and row 1.
|
Matrix2f |
_m10(float m10)
Set the value of the matrix element at column 1 and row 0.
|
Matrix2f |
_m11(float m11)
Set the value of the matrix element at column 1 and row 1.
|
Matrix2f |
add(Matrix2fc other)
Component-wise add
this and other. |
Matrix2f |
add(Matrix2fc other,
Matrix2f dest)
Component-wise add
this and other and store the result in dest. |
float |
determinant()
Return the determinant of this matrix.
|
boolean |
equals(Matrix2fc m,
float 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. |
float[] |
get(float[] arr)
Store this matrix into the supplied float array in column-major order.
|
float[] |
get(float[] arr,
int offset)
Store this matrix into the supplied float array in column-major order at the given offset.
|
FloatBuffer |
get(FloatBuffer buffer)
Store this matrix in column-major order into the supplied
FloatBuffer 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. |
FloatBuffer |
get(int index,
FloatBuffer buffer)
Store this matrix in column-major order into the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
float |
get(int column,
int row)
Get the matrix element value at the given column and row.
|
Matrix2f |
get(Matrix2f dest)
Get the current values of
this matrix and store them into
dest. |
Matrix3f |
get(Matrix3f dest)
Get the current values of
this matrix and store them as
the rotational component of dest. |
Matrix3x2f |
get(Matrix3x2f dest)
Get the current values of
this matrix and store them as
the rotational component of dest. |
Vector2f |
getColumn(int column,
Vector2f dest)
Get the column at the given
column index, starting with 0. |
float |
getRotation()
Get the angle of the rotation component of
this matrix. |
Vector2f |
getRow(int row,
Vector2f dest)
Get the row at the given
row index, starting with 0. |
Vector2f |
getScale(Vector2f 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. |
FloatBuffer |
getTransposed(FloatBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
FloatBuffer 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. |
FloatBuffer |
getTransposed(int index,
FloatBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
int |
hashCode() |
Matrix2f |
identity()
Set this matrix to the identity.
|
Matrix2f |
invert()
Invert this matrix.
|
Matrix2f |
invert(Matrix2f dest)
Invert the
this matrix and store the result in dest. |
Matrix2f |
lerp(Matrix2fc other,
float t)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in this. |
Matrix2f |
lerp(Matrix2fc other,
float t,
Matrix2f dest)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in dest. |
float |
m00()
Return the value of the matrix element at column 0 and row 0.
|
Matrix2f |
m00(float m00)
Set the value of the matrix element at column 0 and row 0.
|
float |
m01()
Return the value of the matrix element at column 0 and row 1.
|
Matrix2f |
m01(float m01)
Set the value of the matrix element at column 0 and row 1.
|
float |
m10()
Return the value of the matrix element at column 1 and row 0.
|
Matrix2f |
m10(float m10)
Set the value of the matrix element at column 1 and row 0.
|
float |
m11()
Return the value of the matrix element at column 1 and row 1.
|
Matrix2f |
m11(float m11)
Set the value of the matrix element at column 1 and row 1.
|
Matrix2f |
mul(Matrix2fc right)
Multiply this matrix by the supplied
right matrix. |
Matrix2f |
mul(Matrix2fc right,
Matrix2f dest)
Multiply this matrix by the supplied
right matrix and store the result in dest. |
Matrix2f |
mulComponentWise(Matrix2fc other)
Component-wise multiply
this by other. |
Matrix2f |
mulComponentWise(Matrix2fc other,
Matrix2f dest)
Component-wise multiply
this by other and store the result in dest. |
Matrix2f |
mulLocal(Matrix2fc left)
Pre-multiply this matrix by the supplied
left matrix and store the result in this. |
Matrix2f |
mulLocal(Matrix2fc left,
Matrix2f dest)
Pre-multiply this matrix by the supplied
left matrix and store the result in dest. |
Matrix2f |
normal()
Set
this matrix to its own normal matrix. |
Matrix2f |
normal(Matrix2f dest)
Compute a normal matrix from
this matrix and store it into dest. |
Vector2f |
normalizedPositiveX(Vector2f dir)
Obtain the direction of
+X before the transformation represented by this orthogonal matrix is applied. |
Vector2f |
normalizedPositiveY(Vector2f dir)
Obtain the direction of
+Y before the transformation represented by this orthogonal matrix is applied. |
Vector2f |
positiveX(Vector2f dir)
Obtain the direction of
+X before the transformation represented by this matrix is applied. |
Vector2f |
positiveY(Vector2f dir)
Obtain the direction of
+Y before the transformation represented by this matrix is applied. |
void |
readExternal(ObjectInput in) |
Matrix2f |
rotate(float angle)
Apply rotation about the origin to this matrix by rotating the given amount of radians.
|
Matrix2f |
rotate(float angle,
Matrix2f dest)
Apply rotation to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix2f |
rotateLocal(float angle)
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the origin.
|
Matrix2f |
rotateLocal(float angle,
Matrix2f dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix2f |
rotation(float angle)
Set this matrix to a rotation matrix which rotates the given radians about the origin.
|
Matrix2f |
scale(float xy)
Apply scaling to this matrix by uniformly scaling all base axes by the given
xy factor. |
Matrix2f |
scale(float x,
float y)
Apply scaling to this matrix by scaling the base axes by the given x and
y factors.
|
Matrix2f |
scale(float x,
float y,
Matrix2f dest)
Apply scaling to this matrix by scaling the base axes by the given x and
y factors and store the result in
dest. |
Matrix2f |
scale(float xy,
Matrix2f dest)
Apply scaling to this matrix by uniformly scaling all base axes by the given
xy factor
and store the result in dest. |
Matrix2f |
scale(Vector2fc xy)
Apply scaling to this matrix by scaling the base axes by the given
xy.x and
xy.y factors, respectively. |
Matrix2f |
scale(Vector2fc xy,
Matrix2f 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. |
Matrix2f |
scaleLocal(float x,
float y)
Pre-multiply scaling to this matrix by scaling the base axes by the given x and
y factors.
|
Matrix2f |
scaleLocal(float x,
float y,
Matrix2f 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. |
Matrix2f |
scaling(float factor)
Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.
|
Matrix2f |
scaling(float x,
float y)
Set this matrix to be a simple scale matrix.
|
Matrix2f |
scaling(Vector2fc xy)
Set this matrix to be a simple scale matrix which scales the base axes by
xy.x and xy.y respectively. |
Matrix2f |
set(ByteBuffer buffer)
Set the values of this matrix by reading 4 float values from the given
ByteBuffer in column-major order,
starting at its current position. |
Matrix2f |
set(float[] m)
Set the values in this matrix based on the supplied float array.
|
Matrix2f |
set(FloatBuffer buffer)
Set the values of this matrix by reading 4 float values from the given
FloatBuffer in column-major order,
starting at its current position. |
Matrix2f |
set(float m00,
float m01,
float m10,
float m11)
Set the values within this matrix to the supplied float values.
|
Matrix2f |
set(int column,
int row,
float value)
Set the matrix element at the given column and row to the specified value.
|
Matrix2f |
set(Matrix2fc m)
Set the elements of this matrix to the ones in
m. |
Matrix2f |
set(Matrix3fc m)
Set the elements of this matrix to the upper left 2x2 of the given
Matrix3fc. |
Matrix2f |
set(Matrix3x2fc m)
Set the elements of this matrix to the left 2x2 submatrix of
m. |
Matrix2f |
set(Vector2fc col0,
Vector2fc col1)
Set the two columns of this matrix to the supplied vectors, respectively.
|
Matrix2f |
setColumn(int column,
float x,
float y)
Set the column at the given
column index, starting with 0. |
Matrix2f |
setColumn(int column,
Vector2fc src)
Set the column at the given
column index, starting with 0. |
Matrix2f |
setRow(int row,
float x,
float y)
Set the row at the given
row index, starting with 0. |
Matrix2f |
setRow(int row,
Vector2fc src)
Set the row at the given
row index, starting with 0. |
Matrix2f |
sub(Matrix2fc subtrahend)
Component-wise subtract
subtrahend from this. |
Matrix2f |
sub(Matrix2fc other,
Matrix2f dest)
Component-wise subtract
subtrahend from this and store the result in dest. |
Matrix2f |
swap(Matrix2f other)
Exchange the values of
this matrix with the given other 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. |
Vector2f |
transform(float x,
float y,
Vector2f dest)
Transform the vector
(x, y) by this matrix and store the result in dest. |
Vector2f |
transform(Vector2f v)
Transform the given vector by this matrix.
|
Vector2f |
transform(Vector2fc v,
Vector2f dest)
Transform the given vector by this matrix and store the result in
dest. |
Vector2f |
transformTranspose(float x,
float y,
Vector2f dest)
Transform the vector
(x, y) by the transpose of this matrix and store the result in dest. |
Vector2f |
transformTranspose(Vector2f v)
Transform the given vector by the transpose of this matrix.
|
Vector2f |
transformTranspose(Vector2fc v,
Vector2f dest)
Transform the given vector by the transpose of this matrix and store the result in
dest. |
Matrix2f |
transpose()
Transpose this matrix.
|
Matrix2f |
transpose(Matrix2f dest)
Transpose
this matrix and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
Matrix2f |
zero()
Set all values within this matrix to zero.
|
public Matrix2f()
public Matrix2f(Matrix2fc mat)
Matrix2f and make it a copy of the given matrix.mat - the Matrix2fc to copy the values frompublic Matrix2f(float m00,
float m01,
float m10,
float m11)
m00 - the value of m00m01 - the value of m01m10 - the value of m10m11 - the value of m11public Matrix2f(FloatBuffer buffer)
Matrix2f by reading its 4 float components from the given FloatBuffer
at the buffer's current position.
That FloatBuffer is expected to hold the values in column-major order.
The buffer's position will not be changed by this method.
buffer - the FloatBuffer to read the matrix values frompublic float m00()
Matrix2fcpublic float m01()
Matrix2fcpublic float m10()
Matrix2fcpublic float m11()
Matrix2fcpublic Matrix2f m00(float m00)
m00 - the new valuepublic Matrix2f m01(float m01)
m01 - the new valuepublic Matrix2f m10(float m10)
m10 - the new valuepublic Matrix2f m11(float m11)
m11 - the new valuepublic Matrix2f _m00(float m00)
m00 - the new valuepublic Matrix2f _m01(float m01)
m01 - the new valuepublic Matrix2f _m10(float m10)
m10 - the new valuepublic Matrix2f _m11(float m11)
m11 - the new valuepublic Matrix2f set(Matrix2fc m)
m.m - the matrix to copy the elements frompublic Matrix2f set(Matrix3x2fc m)
m.m - the matrix to copy the elements frompublic Matrix2f set(Matrix3fc m)
Matrix3fc.m - the Matrix3fc to copy the values frompublic Matrix2f mul(Matrix2fc right)
right matrix.
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 Matrix2f mul(Matrix2fc right, Matrix2f dest)
Matrix2fcright 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!
public Matrix2f mulLocal(Matrix2fc 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 Matrix2f mulLocal(Matrix2fc left, Matrix2f dest)
Matrix2fcleft 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!
public Matrix2f set(float m00, float m01, float m10, float m11)
m00, m10
m01, m11
m00 - the new value of m00m01 - the new value of m01m10 - the new value of m10m11 - the new value of m11public Matrix2f set(float[] m)
0, 2
1, 3
This method only uses the first 4 values, all others are ignored.
m - the array to read the matrix values frompublic Matrix2f set(Vector2fc col0, Vector2fc col1)
col0 - the first columncol1 - the second columnpublic float determinant()
Matrix2fcdeterminant in interface Matrix2fcpublic Matrix2f invert()
public Matrix2f invert(Matrix2f dest)
Matrix2fcthis matrix and store the result in dest.public Matrix2f transpose()
public Matrix2f transpose(Matrix2f dest)
Matrix2fcthis matrix and store the result in dest.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 Matrix2f get(Matrix2f dest)
this matrix and store them into
dest.
This is the reverse method of set(Matrix2fc) and allows to obtain
intermediate calculation results when chaining multiple transformations.
get in interface Matrix2fcdest - the destination matrixset(Matrix2fc)public Matrix3x2f get(Matrix3x2f dest)
Matrix2fcthis matrix and store them as
the rotational component of dest. All other values of dest will
be set to 0.get in interface Matrix2fcdest - the destination matrixMatrix3x2f.set(Matrix2fc)public Matrix3f get(Matrix3f dest)
Matrix2fcthis matrix and store them as
the rotational component of dest. All other values of dest will
be set to identity.get in interface Matrix2fcdest - the destination matrixMatrix3f.set(Matrix2fc)public float getRotation()
Matrix2fcthis matrix.
This method assumes that there is a valid rotation to be returned, i.e. that
atan2(-m10, m00) == atan2(m01, m11).
getRotation in interface Matrix2fcpublic FloatBuffer get(FloatBuffer buffer)
Matrix2fcFloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the matrix is stored, use Matrix2fc.get(int, FloatBuffer), taking
the absolute position as parameter.
get in interface Matrix2fcbuffer - will receive the values of this matrix in column-major order at its current positionMatrix2fc.get(int, FloatBuffer)public FloatBuffer get(int index, FloatBuffer buffer)
Matrix2fcFloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
public ByteBuffer get(ByteBuffer buffer)
Matrix2fcByteBuffer 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 Matrix2fc.get(int, ByteBuffer), taking
the absolute position as parameter.
get in interface Matrix2fcbuffer - will receive the values of this matrix in column-major order at its current positionMatrix2fc.get(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
Matrix2fcByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
public FloatBuffer getTransposed(FloatBuffer buffer)
Matrix2fcFloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the matrix is stored, use Matrix2fc.getTransposed(int, FloatBuffer), taking
the absolute position as parameter.
getTransposed in interface Matrix2fcbuffer - will receive the values of this matrix in column-major order at its current positionMatrix2fc.getTransposed(int, FloatBuffer)public FloatBuffer getTransposed(int index, FloatBuffer buffer)
Matrix2fcFloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
getTransposed in interface Matrix2fcindex - the absolute position into the FloatBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer getTransposed(ByteBuffer buffer)
Matrix2fcByteBuffer 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 Matrix2fc.getTransposed(int, ByteBuffer), taking
the absolute position as parameter.
getTransposed in interface Matrix2fcbuffer - will receive the values of this matrix in column-major order at its current positionMatrix2fc.getTransposed(int, ByteBuffer)public ByteBuffer getTransposed(int index, ByteBuffer buffer)
Matrix2fcByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
getTransposed in interface Matrix2fcindex - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic float[] get(float[] arr,
int offset)
Matrix2fcpublic float[] get(float[] arr)
Matrix2fc
In order to specify an explicit offset into the array, use the method Matrix2fc.get(float[], int).
get in interface Matrix2fcarr - the array to write the matrix values intoMatrix2fc.get(float[], int)public Matrix2f set(FloatBuffer buffer)
FloatBuffer in column-major order,
starting at its current position.
The FloatBuffer is expected to contain the values in column-major order.
The position of the FloatBuffer will not be changed by this method.
buffer - the FloatBuffer to read the matrix values from in column-major orderpublic Matrix2f 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 Matrix2f zero()
public Matrix2f identity()
public Matrix2f scale(Vector2fc xy, Matrix2f dest)
Matrix2fcthis 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!
public Matrix2f scale(Vector2fc xy)
xy.x and
xy.y factors, respectively.
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 Matrix2f scale(float x, float y, Matrix2f dest)
Matrix2fcdest.
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!
public Matrix2f scale(float x, float 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 Matrix2f scale(float xy, Matrix2f dest)
Matrix2fcxy 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 Matrix2fcxy - the factor for all componentsdest - will hold the resultMatrix2fc.scale(float, float, Matrix2f)public Matrix2f scale(float xy)
xy 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 all componentsscale(float, float)public Matrix2f scaleLocal(float x, float y, Matrix2f dest)
Matrix2fcthis 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 Matrix2fcx - the factor of the x componenty - the factor of the y componentdest - will hold the resultpublic Matrix2f scaleLocal(float x, float 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 Matrix2f scaling(float 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(float)public Matrix2f scaling(float x, float y)
x - the scale in xy - the scale in ypublic Matrix2f scaling(Vector2fc xy)
xy.x and xy.y respectively.
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.
xy - the scale in x and y respectivelyscale(Vector2fc)public Matrix2f rotation(float angle)
The produced rotation will rotate a vector counter-clockwise around the origin.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to post-multiply a rotation transformation directly to a
matrix, use rotate() instead.
angle - the angle in radiansrotate(float)public Vector2f transform(Vector2f v)
Matrix2fcpublic Vector2f transform(Vector2fc v, Vector2f dest)
Matrix2fcdest.public Vector2f transform(float x, float y, Vector2f dest)
Matrix2fc(x, y) by this matrix and store the result in dest.public Vector2f transformTranspose(Vector2f v)
Matrix2fctransformTranspose in interface Matrix2fcv - the vector to transformpublic Vector2f transformTranspose(Vector2fc v, Vector2f dest)
Matrix2fcdest.transformTranspose in interface Matrix2fcv - the vector to transformdest - will hold the resultpublic Vector2f transformTranspose(float x, float y, Vector2f dest)
Matrix2fc(x, y) by the transpose of this matrix and store the result in dest.transformTranspose in interface Matrix2fcx - the x coordinate of the vector to transformy - the y coordinate of the vector to transformdest - will hold the resultpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException
readExternal in interface ExternalizableIOExceptionpublic Matrix2f rotate(float angle)
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
angle - the angle in radianspublic Matrix2f rotate(float angle, Matrix2f dest)
Matrix2fcdest.
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
public Matrix2f rotateLocal(float angle)
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!
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use rotation().
Reference: http://en.wikipedia.org
angle - the angle in radians to rotate about the X axisrotation(float)public Matrix2f rotateLocal(float angle, Matrix2f dest)
Matrix2fcdest.
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
rotateLocal in interface Matrix2fcangle - the angle in radiansdest - will hold the resultpublic Vector2f getRow(int row, Vector2f dest) throws IndexOutOfBoundsException
Matrix2fcrow index, starting with 0.getRow in interface Matrix2fcrow - the row index in [0..1]dest - will hold the row componentsIndexOutOfBoundsException - if row is not in [0..1]public Matrix2f setRow(int row, Vector2fc src) throws IndexOutOfBoundsException
row index, starting with 0.row - the row index in [0..1]src - the row components to setIndexOutOfBoundsException - if row is not in [0..1]public Matrix2f setRow(int row, float x, float y) throws IndexOutOfBoundsException
row index, starting with 0.row - the row index in [0..1]x - the first element in the rowy - the second element in the rowIndexOutOfBoundsException - if row is not in [0..1]public Vector2f getColumn(int column, Vector2f dest) throws IndexOutOfBoundsException
Matrix2fccolumn index, starting with 0.getColumn in interface Matrix2fccolumn - the column index in [0..1]dest - will hold the column componentsIndexOutOfBoundsException - if column is not in [0..1]public Matrix2f setColumn(int column, Vector2fc src) throws IndexOutOfBoundsException
column index, starting with 0.column - the column index in [0..1]src - the column components to setIndexOutOfBoundsException - if column is not in [0..1]public Matrix2f setColumn(int column, float x, float y) throws IndexOutOfBoundsException
column index, starting with 0.column - the column index in [0..1]x - the first element in the columny - the second element in the columnIndexOutOfBoundsException - if column is not in [0..1]public float get(int column,
int row)
Matrix2fcpublic Matrix2f set(int column, int row, float value)
column - the colum index in [0..1]row - the row index in [0..1]value - the valuepublic Matrix2f normal()
this matrix to its own normal matrix.
Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors,
then this method need not be invoked, since in that case this itself is its normal matrix.
In this case, use set(Matrix2fc) to set a given Matrix2f to this matrix.
set(Matrix2fc)public Matrix2f normal(Matrix2f dest)
this matrix and store it into dest.
Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors,
then this method need not be invoked, since in that case this itself is its normal matrix.
In this case, use set(Matrix2fc) to set a given Matrix2f to this matrix.
normal in interface Matrix2fcdest - will hold the resultset(Matrix2fc)public Vector2f getScale(Vector2f dest)
Matrix2fcthis matrix for the three base axes.public Vector2f positiveX(Vector2f dir)
Matrix2fc+X before the transformation represented by this matrix is applied.
This method is equivalent to the following code:
Matrix2f inv = new Matrix2f(this).invert(); inv.transform(dir.set(1, 0)).normalize();If
this is already an orthogonal matrix, then consider using Matrix2fc.normalizedPositiveX(Vector2f) instead.public Vector2f normalizedPositiveX(Vector2f dir)
Matrix2fc+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:
Matrix2f inv = new Matrix2f(this).transpose(); inv.transform(dir.set(1, 0));
normalizedPositiveX in interface Matrix2fcdir - will hold the direction of +Xpublic Vector2f positiveY(Vector2f dir)
Matrix2fc+Y before the transformation represented by this matrix is applied.
This method is equivalent to the following code:
Matrix2f inv = new Matrix2f(this).invert(); inv.transform(dir.set(0, 1)).normalize();If
this is already an orthogonal matrix, then consider using Matrix2fc.normalizedPositiveY(Vector2f) instead.public Vector2f normalizedPositiveY(Vector2f dir)
Matrix2fc+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:
Matrix2f inv = new Matrix2f(this).transpose(); inv.transform(dir.set(0, 1));
normalizedPositiveY in interface Matrix2fcdir - will hold the direction of +Ypublic boolean equals(Matrix2fc m, float delta)
Matrix2fcthis 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.
public Matrix2f swap(Matrix2f other)
this matrix with the given other matrix.other - the other matrix to exchange the values withpublic Matrix2f add(Matrix2fc other)
this and other.other - the other addendpublic Matrix2f add(Matrix2fc other, Matrix2f dest)
Matrix2fcthis and other and store the result in dest.public Matrix2f sub(Matrix2fc subtrahend)
subtrahend from this.subtrahend - the subtrahendpublic Matrix2f sub(Matrix2fc other, Matrix2f dest)
Matrix2fcsubtrahend from this and store the result in dest.public Matrix2f mulComponentWise(Matrix2fc other)
this by other.other - the other matrixpublic Matrix2f mulComponentWise(Matrix2fc other, Matrix2f dest)
Matrix2fcthis by other and store the result in dest.mulComponentWise in interface Matrix2fcother - the other matrixdest - will hold the resultpublic Matrix2f lerp(Matrix2fc other, float t)
this and other using the given interpolation factor t
and store the result in this.
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.0public Matrix2f lerp(Matrix2fc other, float t, Matrix2f dest)
Matrix2fcthis 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.
Copyright © 2015–2019 JOML. All rights reserved.