|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.slowmath.Matrix3D
public class Matrix3D
Matrix3D is a 4x4 matrix class intended for graphical tranformation operations, however, it isn't designed in the typical fashion of most graphical Matrix classes I've seen. It's immutable, just like the rest of the classes in this package and is designed for precision and code readability, not speed, but it should be capable of either depending on how the MathUtil class is configured.
Constructor Summary | |
---|---|
Matrix3D(Quaternion r1,
Quaternion r2,
Quaternion r3,
Quaternion r4)
Constructs a Matrix3D from four Quaternions. |
|
Matrix3D(Real[] values)
Constructs a Matrix3D using the array of Reals. |
Method Summary | |
---|---|
Matrix3D |
applyPerspective(Real d)
Applies a perspective transformation and returns the result. |
Real |
get(int row,
int col)
Returns a given element of this Matrix3D. |
static Matrix3D |
identity()
Provides an identity Matrix3D. |
Matrix3D |
multiply(Matrix3D m)
Multiplies m (the multiplicand) by this (the multiplier). |
static Matrix3D |
perspectiveMatrix(Real d)
Constructs a perspective transformation Matrix3D. |
Matrix3D |
rotate(Quaternion q)
Applies a rotation transformation and returns the result. |
Matrix3D |
rotate(Vector v)
Applies a rotation transformation and returns the result. |
Matrix3D |
rotateX(Real t)
Applies a rotation transformation and returns the result. |
Matrix3D |
rotateY(Real t)
Applies a rotation transformation and returns the result. |
Matrix3D |
rotateZ(Real t)
Applies a rotation transformation and returns the result. |
static Matrix3D |
rotationMatrix(Quaternion q)
Constructs a rotation Matrix3D for q. |
static Matrix3D |
rotationMatrix(Vector v)
Constructs a rotation Matrix3D for v. |
Matrix3D |
scale(Real s)
Applies a scale transformation and returns the result. |
Matrix3D |
scale(Real x,
Real y,
Real z)
Applies a scale transformation and returns the result. |
Matrix3D |
scale(Vector v)
Applies a scale transformation and returns the result. |
static Matrix3D |
scalingMatrix(Real s)
Constructs a scaling Matrix3D. |
static Matrix3D |
scalingMatrix(Real vx,
Real vy,
Real vz)
Constructs a scaling Matrix3D. |
static Matrix3D |
scalingMatrix(Vector v)
Constructs a scaling Matrix3D. |
double[] |
toDoubleArray()
|
float[] |
toFloatArray()
|
java.lang.String |
toString()
|
Quaternion |
transform(Quaternion v)
Transforms v and returns the result. |
Vector |
transform(Vector v)
Transforms v and returns the result. |
Matrix3D |
translate(Vector v)
Applies a translation transformation and returns the result. |
static Matrix3D |
translationMatrix(Vector v)
Constructs a translation Matrix3D. |
Matrix3D |
transpose()
Returns a transposed version of this Matrix. |
static Matrix3D |
xRotationMatrix(Real t)
Constructs a rotation Matrix3D for rotating around the X axis. |
static Matrix3D |
yRotationMatrix(Real t)
Constructs a rotation Matrix3D for rotating around the Y axis. |
static Matrix3D |
zRotationMatrix(Real t)
Constructs a rotation Matrix3D for rotating around the Z axis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Matrix3D(Quaternion r1, Quaternion r2, Quaternion r3, Quaternion r4)
r1
- the first row.r2
- the first row.r3
- the first row.r4
- the first row.public Matrix3D(Real[] values)
values
- the Reals to use.Method Detail |
---|
public Real get(int row, int col)
row
- the row to access.col
- the column to access.
public Matrix3D transpose()
public Vector transform(Vector v)
v
- the Vector to transform.
public Quaternion transform(Quaternion v)
v
- the Quaternion to transform.
public Matrix3D multiply(Matrix3D m)
m
- the multiplicand.
public Matrix3D translate(Vector v)
v
- the Vector holding values for translation along the three axes.
public Matrix3D scale(Vector v)
v
- the Vector containing scaling factors for the three axes.
public Matrix3D scale(Real s)
s
- the scaling factor for all three axes.
public Matrix3D scale(Real x, Real y, Real z)
x
- the scaling factor along the X axis.y
- the scaling factor along the Y axis.z
- the scaling factor along the Z axis.
public Matrix3D rotateX(Real t)
t
- the angle of rotation used to rotate around the X axis.
public Matrix3D rotateY(Real t)
t
- the angle of rotation used to rotate around the Y axis.
public Matrix3D rotateZ(Real t)
t
- the angle of rotation used to rotate around the Z axis.
public Matrix3D rotate(Vector v)
v
- the Vector representing the rotation.
public Matrix3D rotate(Quaternion q)
q
- the Quaternion representing the rotation.
public Matrix3D applyPerspective(Real d)
d
- the distance from the viewpoint to the viewpane.
public float[] toFloatArray()
public double[] toDoubleArray()
public java.lang.String toString()
toString
in class java.lang.Object
public static Matrix3D translationMatrix(Vector v)
v
- the Vector to translate by.
public static Matrix3D scalingMatrix(Real s)
s
- the scaling factor all three axes.
public static Matrix3D scalingMatrix(Vector v)
v
- the scaling Vector with factors for the three axes.
public static Matrix3D scalingMatrix(Real vx, Real vy, Real vz)
vx
- the scaling factor along the X axis.vy
- the scaling factor along the Y axis.vz
- the scaling factor along the Z axis.
public static Matrix3D xRotationMatrix(Real t)
t
- (short for theta) the angle of rotation.
public static Matrix3D yRotationMatrix(Real t)
t
- (short for theta) the angle of rotation.
public static Matrix3D zRotationMatrix(Real t)
t
- (short for theta) the angle of rotation.
public static Matrix3D perspectiveMatrix(Real d)
d
- the distance from the viewpoint and the viewing plane.
public static Matrix3D rotationMatrix(Vector v)
v
- the Vector describing a 3D rotation.
public static Matrix3D rotationMatrix(Quaternion q)
q
- the Quaternion being used to represent a 3D rotation.
public static Matrix3D identity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |