|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.math.CoordinateSystem
public class CoordinateSystem
The CoordinateSystem class describes the position and orientation of one coordinate system relative to another one. It is defined by three vectors. orig defines the position of the origin of the new coordinate system, while zdir and updir define the directions of the z and y axes, respectively. (Note that the y axis will only be parallel to updir in the special case that zdir and updir are perpendicular to each other.) Alternatively, the orientation can be represented by three rotation angles about the (global) x, y, and z axes. Both representations are maintained internally.
Constructor Summary | |
---|---|
CoordinateSystem()
Create a new CoordinateSystem which represents an identity transformation (i.e. |
|
CoordinateSystem(java.io.DataInputStream in)
Create a CoordinateSystem by reading the information that was written by writeToFile(). |
|
CoordinateSystem(Vec3 orig,
double x,
double y,
double z)
Create a new coordinate system. |
|
CoordinateSystem(Vec3 orig,
Vec3 zdir,
Vec3 updir)
Create a new coordinate system. |
Method Summary | |
---|---|
void |
copyCoords(CoordinateSystem c)
Make this CoordianteSystem identical to another one. |
CoordinateSystem |
duplicate()
Create an exact duplicate of this CoordinateSystem. |
boolean |
equals(java.lang.Object coords)
Determine whether this coordinate system is identical to another one. |
Mat4 |
fromLocal()
Return a matrix which will transform points from this coordinate system to the outside coordinate system with respect to which it is defined. |
double |
getAxisAngleRotation(Vec3 axis)
A rotation can also be described by specifying a rotation axis, and a rotation angle about that axis. |
Vec3 |
getOrigin()
Get the origin of this CoordinateSystem. |
double[] |
getRotationAngles()
Return the x, y, and z rotation angles. |
Vec3 |
getUpDirection()
Get the vector used to define "up" in this CoordinateSystem (usually but not always the y axis direction). |
Vec3 |
getZDirection()
Get this CoordinateSystem's z axis direction. |
void |
setOrientation(double x,
double y,
double z)
Set the orientation of this CoordinateSystem. |
void |
setOrientation(Vec3 zdir,
Vec3 updir)
Set the orientation of this CoordinateSystem. |
void |
setOrigin(Vec3 orig)
Set the position of this CoordinateSystem's origin. |
Mat4 |
toLocal()
Return a matrix which will transform points from the outside coordinate system to this local coordinate system. |
void |
transformAxes(Mat4 m)
Transform this CoordinateSystem's orientation by applying a matrix to its axis directions. |
void |
transformCoordinates(Mat4 m)
Transform this CoordinateSystem's position and orientation by applying a matrix to its origin and axis directions. |
void |
transformOrigin(Mat4 m)
Transform this CoordinateSystem's position by applying a matrix to its origin. |
void |
writeToFile(java.io.DataOutputStream out)
Write out a serialized representation of this CoordinateSystem. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CoordinateSystem()
public CoordinateSystem(Vec3 orig, Vec3 zdir, Vec3 updir)
orig
- the origin of the new coordinate systemzdir
- the direction of the new coordinate system's z axisupdir
- defines the "up" direction. If this is perpendicular to zdir, this will be
the y axis direction of the new coordinate system.public CoordinateSystem(Vec3 orig, double x, double y, double z)
orig
- the origin of the new coordinate systemx
- the rotation angle around the x axisy
- the rotation angle around the y axisz
- the rotation angle around the z axispublic CoordinateSystem(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public final CoordinateSystem duplicate()
public final void copyCoords(CoordinateSystem c)
public final boolean equals(java.lang.Object coords)
equals
in class java.lang.Object
public final void setOrigin(Vec3 orig)
public final void setOrientation(Vec3 zdir, Vec3 updir)
zdir
- the direction of this coordinate system's z axisupdir
- defines the "up" direction. If this is perpendicular to zdir, this will become
the y axis direction.public final void setOrientation(double x, double y, double z)
x
- the rotation angle around the x axisy
- the rotation angle around the y axisz
- the rotation angle around the z axispublic final Vec3 getOrigin()
public final Vec3 getZDirection()
public final Vec3 getUpDirection()
public final double[] getRotationAngles()
public final void transformAxes(Mat4 m)
public final void transformOrigin(Mat4 m)
public final void transformCoordinates(Mat4 m)
public final Mat4 fromLocal()
public final Mat4 toLocal()
public final double getAxisAngleRotation(Vec3 axis)
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 |