jglcore
Class JGL_3DTriangle

java.lang.Object
  extended by jglcore.JGL_3DTriangle

public final class JGL_3DTriangle
extends java.lang.Object

Representation of a basic 3D triangle. A JGL_3DTriangle stores 3 points (JGL_3DVector objects) and one color (java.awt.Color object).
The triangle's front side is the one where the points are in the counter clockwise order.

Author:
Nicolas Devere

Field Summary
 java.awt.Color color
          Display color
 JGL_3DVector point1
          First point
 JGL_3DVector point2
          Second point
 JGL_3DVector point3
          Third point
 
Constructor Summary
JGL_3DTriangle(JGL_3DVector p1, JGL_3DVector p2, JGL_3DVector p3)
          Constructs a white triangle with the specified 3 points.
JGL_3DTriangle(JGL_3DVector p1, JGL_3DVector p2, JGL_3DVector p3, java.awt.Color c)
          Constructs a triangle with the specified 3 points and color.
 
Method Summary
 void assign(JGL_3DVector p1, JGL_3DVector p2, JGL_3DVector p3)
          Assigns values of the specified 3 points to this triangle.
 void display()
          Displays the triangle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

point1

public JGL_3DVector point1
First point


point2

public JGL_3DVector point2
Second point


point3

public JGL_3DVector point3
Third point


color

public java.awt.Color color
Display color

Constructor Detail

JGL_3DTriangle

public JGL_3DTriangle(JGL_3DVector p1,
                      JGL_3DVector p2,
                      JGL_3DVector p3)
Constructs a white triangle with the specified 3 points.

Parameters:
p1 - : the first point
p2 - : the second point
p3 - : the third point

JGL_3DTriangle

public JGL_3DTriangle(JGL_3DVector p1,
                      JGL_3DVector p2,
                      JGL_3DVector p3,
                      java.awt.Color c)
Constructs a triangle with the specified 3 points and color.

Parameters:
p1 - : the first point
p2 - : the second point
p3 - : the third point
c - : the display color
Method Detail

assign

public void assign(JGL_3DVector p1,
                   JGL_3DVector p2,
                   JGL_3DVector p3)
Assigns values of the specified 3 points to this triangle. Color in unchanged.

Parameters:
p1 - : the first point
p2 - : the second point
p3 - : the third point

display

public void display()
Displays the triangle.