|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Matrix4x4
Implementation of a 4x4 matrix suited for use in a 2D and 3D graphics rendering engine.
Constructor Summary | |
Matrix4x4()
Construct a 4x4 identity matrix. |
|
Matrix4x4(double[] m)
Construct a 4x4 matrix with the specified element values. |
|
Matrix4x4(double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33)
Construct a 4x4 matrix with the specified values. |
|
Matrix4x4(Matrix4x4 matrix)
Constrauct a 4x4 matrix as a copy of the specified matrix. |
Method Summary | |
void |
add(Matrix4x4 matrix)
Add the specified 4x4 matrix to this matrix. |
static Matrix4x4 |
add(Matrix4x4 m1,
Matrix4x4 m2)
Add two matrices and return the result matrix. |
boolean |
equals(Object object)
Check if this 4x4 matrix equals the specified object. |
double[] |
get()
Return the values of this 4x4 matrix. |
double |
getElement(int i,
int j)
Return matrix element [i,j]. |
static Matrix4x4 |
inverse(Matrix4x4 matrix)
Return the inverse of the specified matrix. |
void |
invert()
Invert this 4x4 matrix. |
void |
multiply(Matrix4x4 matrix)
Multiply this 4x4 matrix with the specified matrix and store the result in this 4x4 matrix. |
static Matrix4x4 |
multiply(Matrix4x4 m1,
Matrix4x4 m2)
Multiply two matrices and return the result matrix. |
Vector4 |
multiply(Vector4 vector4)
Multiply this 4x4 matrix with the specified vector. |
void |
rotate(double angle,
double[] p0,
double[] p1)
Apply rotation around an arbitrary axis. |
void |
rotateX(double angle)
Apply rotation around X axis to this matrix. |
void |
rotateY(double angle)
Apply rotation around Y axis to this matrix. |
void |
rotateZ(double angle)
Apply rotation around z axis to this matrix. |
void |
scale(double xScale,
double yScale,
double zScale)
Apply scaling (relative to origo) to this 4x4 matrix. |
void |
scale(double xScale,
double yScale,
double zScale,
double[] fixedPoint)
Apply scaling relative to a fixed point to this 4x4 matrix. |
void |
set(double[] m)
Set the values of this 4x4 matrix. |
void |
set(double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33)
Set the values of this 4x4 matrix. |
void |
set(Matrix4x4 matrix)
Set the value of this 4x4matrix according to the specified matrix |
void |
setElement(int i,
int j,
double value)
Set specified matrix element. |
void |
setIdentity()
Make an identity matrix out of this 4x4 matrix. |
void |
setWorld2DeviceTransform(double[] w0,
double[] w1,
double[] w2,
int x0,
int y0,
int width,
int height)
Make this 4x4 matrix a world-2-device transformation matrix. |
Vector4 |
solve(Vector4 vector)
Solve the A x = b equation, where A is this 4x4 matrix, b is the specified result vector and the returned vector is the unknown x. |
String |
toString()
Create a string representation of this matrix. |
double[] |
transformPoint(double[] point)
Transform one coordinate using this 4x4 matrix. |
void |
transformPoints(double[] points)
Transform a set of 3D coordinates using this 4x4 matrix. |
void |
transformPoints(int[] points)
Transform a set of 3D coordinates using this 4x4 matrix. |
void |
transformXyPoints(double[] points)
Transform a set of 2D (x,y) coordinates using this 4x4 matrix. |
void |
transformXyPoints(int[] points)
Transform a set of 2D (x,y) coordinates using this 4x4 matrix. |
void |
translate(double dx,
double dy)
Apply specified XY translation to this 4x4 matrix. |
void |
translate(double dx,
double dy,
double dz)
Apply specified translation to this 4x4 matrix. |
Methods inherited from class Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Matrix4x4()
public Matrix4x4(double[] m)
m
- Array of 16 matrix elements, m00, m01, etc.public Matrix4x4(Matrix4x4 matrix)
matrix
- Matrix to copy.public Matrix4x4(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
m00
- Value of element m[0,0].m01
- Value of element m[0,1].m02
- Value of element m[0,2].m03
- Value of element m[0,3].m10
- Value of element m[1,0].m11
- Value of element m[1,1].m12
- Value of element m[1,2].m13
- Value of element m[1,3].m20
- Value of element m[2,0].m21
- Value of element m[2,1].m22
- Value of element m[2,2].m23
- Value of element m[2,3].m30
- Value of element m[3,0].m31
- Value of element m[3,1].m32
- Value of element m[3,2].m33
- Value of element m[3,3].Method Detail |
public void setIdentity()
public void set(Matrix4x4 matrix)
matrix
- Matrix to copy.public void set(double[] m)
m
- Array of 16 matrix elements, m00, m01, etc.public void set(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
m00
- Value of element m[0,0].m01
- Value of element m[0,1].m02
- Value of element m[0,2].m03
- Value of element m[0,3].m10
- Value of element m[1,0].m11
- Value of element m[1,1].m12
- Value of element m[1,2].m13
- Value of element m[1,3].m20
- Value of element m[2,0].m21
- Value of element m[2,1].m22
- Value of element m[2,2].m23
- Value of element m[2,3].m30
- Value of element m[3,0].m31
- Value of element m[3,1].m32
- Value of element m[3,2].m33
- Value of element m[3,3].public double[] get()
public boolean equals(Object object)
equals
in class Object
object
- Object to check.
ClassCastException
- if object is not of type Matrix4x4.public double getElement(int i, int j)
i
- Row of element to get (first row is 0).j
- Column of element to get (first column is 0).
ArrayOutOfBoundsException
public void setElement(int i, int j, double value)
i
- Row of element to set (first row is 0).j
- Column of element to set (first column is 0).value
- New element value.
ArrayOutOfBoundsException
public void add(Matrix4x4 matrix)
matrix
- Matrix to add.public static Matrix4x4 add(Matrix4x4 m1, Matrix4x4 m2)
m1
- First matrix to add.m2
- Second matrix to add.
public void multiply(Matrix4x4 matrix)
matrix
- Matrix to multiply with.public static Matrix4x4 multiply(Matrix4x4 m1, Matrix4x4 m2)
m1
- First matrix to multiply.m2
- Second matrix to multiply.
public Vector4 multiply(Vector4 vector4)
vector4
- Vector to multiply with.
public double[] transformPoint(double[] point)
point
- [x0,y0,z0]
public void transformPoints(double[] points)
public void transformXyPoints(double[] points)
points
- Points to transform [x0,y0,x1,y1,...].public void transformPoints(int[] points)
points
- Points to transform [x0,y0,z0,x1,y1,z1,...].public void transformXyPoints(int[] points)
points
- Points to transform [x0,y0,x1,y1,...].public void translate(double dx, double dy, double dz)
dx
- x translation.dy
- y translation.dz
- z translation.public void translate(double dx, double dy)
dx
- x translation.dy
- y translation.public void rotateX(double angle)
angle
- Angle to rotate [radians].public void rotateY(double angle)
angle
- Angle to rotate [radians].public void rotateZ(double angle)
angle
- Angle to rotate [radians].public void rotate(double angle, double[] p0, double[] p1)
angle
- Angle to rotate [radians]p0
- First point defining the axis (x,y,z)p1
- Second point defining the axis (x,y,z)public void scale(double xScale, double yScale, double zScale)
xScale
- Scaling in x direction.yScale
- Scaling in y direction.zScale
- Scaling in z direction.public void scale(double xScale, double yScale, double zScale, double[] fixedPoint)
xScale
- Scaling in x direction.yScale
- Scaling in y direction.zScale
- Scaling in z direction.fixedPoint
- Scaling origo.public void invert()
public static Matrix4x4 inverse(Matrix4x4 matrix)
matrix
- Matrix to finr the inverse of.
public Vector4 solve(Vector4 vector)
vector
- Result vector
public void setWorld2DeviceTransform(double[] w0, double[] w1, double[] w2, int x0, int y0, int width, int height)
The world system is defined as follows:
w2 o | | | w0 o-------o w1Each point is defined with x,y,z so this system may in effect be arbitrary oriented in space, and may include sharing.
The device system is defined as follows:
width x0,y0 o-------o | height | | oThe matrix maps w2 to (x0,y0), w0 to the lower left corner of the device rectangle, and w1 to the lower right corner of the device rectangle.
w0
- x,y,z coordinate of first world position.w1
- x,y,z coordinate of second world position.w2
- x,y,z coordinate of third world position.x0
- X coordinate of upper left corner of device.y0
- Y coordinate of upper left corner of device.width
- Width of deviceheight
- Height of device.public String toString()
toString
in class Object
|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |