|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmr3d.lang.Triangle3D
The class Triangle3D is able to represent a triangle. It is a composite object consisting of three edges (Edge3D)
Example
// create points forming a triangle
Point3D nullPoint = new Point3D();
Point3D myEndPoint1 = new Point3D(10,0,0);
Point3D myEndPoint2 = new Point3D(0,10,0);
// create edges of the triangle
Edge3D myEdge1 = new Edge3D(nullPoint, myEndPoint1);
Edge3D myEdge2 = new Edge3D(myEndPoint1, myEndPoint2);
Edge3D myEdge3 = new Edge3D(myEndPoint2, nullPoint);
// define color code
int red = 255;
int green = 100;
int blue = 20;
int myColorCode = mr3d.Graph2D.getColorCode(red, green, blue);
// create the triangle object
Triangle3D myTraingle = new Triangle3D(myEdge1, myEdge2, myEdge3, myColorCode);
myTraingle.planeNormal.toConsole(); // (0,0,-100)
Vector3D,
Edge3D| Field Summary | |
int |
colorCode
Color code of the triangle. |
Edge3D |
edge1
Edge of triangle. |
Edge3D |
edge2
Edge of triangle. |
Edge3D |
edge3
Edge of triangle. |
Vector3D |
planeNormalCCS
Vector object that is used to store the plane normal. |
| Fields inherited from interface mr3d.debug.Debugable |
ERROR_INT, ERROR_STRING |
| Constructor Summary | |
Triangle3D(Edge3D newEdge1,
Edge3D newEdge2,
Edge3D newEdge3,
int color)
Constructs a triangle object from three edge objects. |
|
| Method Summary | |
Vector3D |
calculateNormalCCS()
Calculates the plane normal of the triangle using the camera coordinates The start and end points of edge1 and edge2 are
used to create two vectors. |
void |
reset()
Resets the points to their initial value. |
void |
toConsole()
Prints the contents of the object to the Java console. |
void |
toConsole(java.lang.String msgString)
Prints the contents of the object to the Java console together with an information string. |
void |
transform(Matrix transMat)
Delegate the transformation matrix to the 3D points in the edges. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public int colorCode
colorCode = blueValue + 256*greenValue + 65536*redValue
The color values for blue, green and red used to calculated the the color code can be values between 0 and 255. The color code may be a number between 0 (black) and 16.777.215 (white).
public Edge3D edge1
public Edge3D edge2
public Edge3D edge3
public Vector3D planeNormalCCS
Vector3D| Constructor Detail |
public Triangle3D(Edge3D newEdge1,
Edge3D newEdge2,
Edge3D newEdge3,
int color)
newEdge1 - edge object to define the border of the trianglenewEdge2 - edge object to define the border of the trianglenewEdge3 - edge object to define the border of the trianglecolor - color code of the triangle| Method Detail |
public Vector3D calculateNormalCCS()
edge1 and edge2 are
used to create two vectors. The cross product of those two
vectors is a vector that is the plane normal.
public void reset()
Point3D.reset()public void toConsole()
Debugable
toConsole in interface Debugablepublic void toConsole(java.lang.String msgString)
Debugable
toConsole in interface Debugablepublic void transform(Matrix transMat)
transform in interface TransformabletransMat - transformation or translation matrixMatrixFactory.createTransMatrix(int, int, int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||