|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.math.Mat4
public class Mat4
This class represents a 4x4 matrix. It is typically used for representing coordinate transformations.
Field Summary | |
---|---|
double |
m11
|
double |
m12
|
double |
m13
|
double |
m14
|
double |
m21
|
double |
m22
|
double |
m23
|
double |
m24
|
double |
m31
|
double |
m32
|
double |
m33
|
double |
m34
|
double |
m41
|
double |
m42
|
double |
m43
|
double |
m44
|
Constructor Summary | |
---|---|
Mat4(java.io.DataInputStream in)
Create a Mat4 by reading in information that was written by writeToFile(). |
|
Mat4(double e11,
double e12,
double e13,
double e14,
double e21,
double e22,
double e23,
double e24,
double e31,
double e32,
double e33,
double e34,
double e41,
double e42,
double e43,
double e44)
Create a new Mat4 by explicitly setting its components. |
Method Summary | |
---|---|
static Mat4 |
axisRotation(Vec3 axis,
double angle)
This routine creates a matrix to rotate a vector around an arbitrary axis. |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
static Mat4 |
identity()
Create an identity matrix. |
static Mat4 |
objectTransform(Vec3 orig,
Vec3 zdir,
Vec3 updir)
Create a matrix which is the inverse of the viewTransform matrix. |
static Mat4 |
perspective(double d)
Create a matrix to implement a perspective projection. |
static Mat4 |
scale(double sx,
double sy,
double sz)
Create a matrix to scale x, y, and z by sx, sy, and sz respectively. |
Mat4 |
times(Mat4 a)
Create a new Mat4 by multiplying two matrices. |
Vec3 |
times(Vec3 v)
Multiply this matrix (M) by a vector (v) and return the product Mv. |
Vec3 |
timesDirection(Vec3 v)
This method is identical to times(), except that v is assumed to be a direction vector. |
Vec2 |
timesXY(Vec3 v)
This method works exactly like the times() method, except that it only calculates the x and y components of the output vector. |
Vec2 |
timesXY(Vec3 v,
Vec2 result)
This method works exactly like the times() method, except that it only calculates the x and y components of the output vector. |
double |
timesZ(Vec3 v)
This method works like the times() method, except that it only calculates the z component of the output vector. |
java.lang.String |
toString()
|
void |
transform(Vec3 v)
This method works like times(), except that the calculation is done in place. |
void |
transformDirection(Vec3 v)
This method works like timesDirection(), except that the calculation is done in place. |
static Mat4 |
translation(double dx,
double dy,
double dz)
Create a matrix to translate a vector by (dx, dy, dz). |
static Mat4 |
viewTransform(Vec3 orig,
Vec3 zdir,
Vec3 updir)
Create a matrix for transforming from world coordinates to viewing coordinates. |
void |
writeToFile(java.io.DataOutputStream out)
Write out a serialized representation of this object. |
static Mat4 |
xrotation(double angle)
Create a matrix that rotates a vector around the X axis. |
static Mat4 |
yrotation(double angle)
Create a matrix that rotates a vector around the Y axis. |
static Mat4 |
zrotation(double angle)
Create a matrix that rotates a vector around the Z axis. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final double m11
public final double m12
public final double m13
public final double m14
public final double m21
public final double m22
public final double m23
public final double m24
public final double m31
public final double m32
public final double m33
public final double m34
public final double m41
public final double m42
public final double m43
public final double m44
Constructor Detail |
---|
public Mat4(double e11, double e12, double e13, double e14, double e21, double e22, double e23, double e24, double e31, double e32, double e33, double e34, double e41, double e42, double e43, double e44)
public Mat4(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public final Mat4 times(Mat4 a)
public final Vec3 times(Vec3 v)
public final Vec3 timesDirection(Vec3 v)
public final Vec2 timesXY(Vec3 v)
public final Vec2 timesXY(Vec3 v, Vec2 result)
public final double timesZ(Vec3 v)
public final void transform(Vec3 v)
public final void transformDirection(Vec3 v)
public static Mat4 identity()
public static Mat4 scale(double sx, double sy, double sz)
public static Mat4 translation(double dx, double dy, double dz)
public static Mat4 xrotation(double angle)
angle
- the rotation angle, in radianspublic static Mat4 yrotation(double angle)
angle
- the rotation angle, in radianspublic static Mat4 zrotation(double angle)
angle
- the rotation angle, in radianspublic static Mat4 axisRotation(Vec3 axis, double angle)
axis
- the axis around which to rotateangle
- the rotation angle, in radianspublic static Mat4 viewTransform(Vec3 orig, Vec3 zdir, Vec3 updir)
public static Mat4 objectTransform(Vec3 orig, Vec3 zdir, Vec3 updir)
public static Mat4 perspective(double d)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void writeToFile(java.io.DataOutputStream out) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |