jme.geometry.primitive
Class Triangle
java.lang.Object
jme.geometry.primitive.Primitive
jme.geometry.primitive.Triangle
- All Implemented Interfaces:
- Geometry
- public class Triangle
- extends Primitive
Triangle
handles the rendering of a single triangle shape. This
triangle shape is defined by three points and maintained in an array of
three Vector
values. The ordering of the array is important
as each index represents a corner of the triangle.
0 - Top
1 - BottomLeft
2 - BottomRight
- Version:
- $Id: Triangle.java,v 1.4 2003/09/08 20:29:27 mojomonkey Exp $
- Author:
- Samuel Wasson
Constructor Summary |
Triangle(Vector[] points)
Constructor instantiates a new Triangle with the given set of
points. |
Method Summary |
Vector[] |
getPoints()
getPoints returns an array of Vectors that represents
each point that makes up the piece of geometry. |
void |
initialize()
initialize sets up the triangle to prepare it for usage. |
void |
preRender()
preRender does nothing for triangle. |
void |
render()
render renders a single triangle with the defined points. |
void |
setPoint(int index,
Vector point)
setPoint sets a specific corner to the given point. |
void |
setPoints(Vector[] points)
setPoints sets the points that define the triangle shape. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
points
Vector[] points
Triangle
public Triangle(Vector[] points)
- Constructor instantiates a new
Triangle
with the given set of
points.
- Parameters:
points
- the points that make up the triangle.
- Throws:
MonkeyRuntimeException
- if points are null.
setPoints
public void setPoints(Vector[] points)
setPoints
sets the points that define the triangle shape.
- Parameters:
points
- the points that make up the triangle.
- Throws:
MonkeyRuntimeException
- if points are null.
setPoint
public void setPoint(int index,
Vector point)
setPoint
sets a specific corner to the given point.
The index of the point should match:
0 - Top
1 - BottomLeft
2 - BottomRight
- Parameters:
index
- the corner to change.point
- the new point of the corner.
render
public void render()
render
renders a single triangle with the defined points.
- Specified by:
render
in interface Geometry
- Specified by:
render
in class Primitive
initialize
public void initialize()
initialize
sets up the triangle to prepare it for usage.
preRender
public void preRender()
preRender
does nothing for triangle.
getPoints
public Vector[] getPoints()
- Description copied from interface:
Geometry
getPoints
returns an array of Vectors that represents
each point that makes up the piece of geometry.
- Returns:
- the array of vectors for the points.