java.lang.Object
org.jfree.chart3d.graphics3d.Face
- Direct Known Subclasses:
DoubleSidedFace,LabelFace
Represents a face in one
Object3D, defined in terms of vertex
indices. It is expected (but not enforced) that all the vertices for
the face lie within a single plane. The face will be visible from the
"front" side only, which is a function of the order in which the vertices
are specified. A special subclass, DoubleSidedFace, is visible
from both front and back.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatcalculateAverageZValue(Point3D[] points) Returns the average z-value.double[]calculateNormal(Point3D[] points) Calculates the normal vector for this face.createPath(Point2D[] pts) Creates and returns a path for the outline of this face.getColor()A convenience method that looks up and returns the color for this face (obtained by querying the object that owns the face).intReturns the offset to add to the vertex indices.booleanReturnstrueif an outline should be drawn for this face, andfalseotherwise.getOwner()Returns the object that this face belongs too (as passed to the constructor).getTag()Returns the tag for this face (alwaysnullfor this class, subclasses may override).intReturns the number of vertices in this face.intgetVertexIndex(int i) Returns the index for the specified vertex.booleanisFrontFacing(Point2D[] projPts) Returnstrueif this face is front facing, andfalseotherwise.voidsetOffset(int offset) Sets the offset to add to the vertex indices.toString()Returns a string representation of this instance, primarily for debugging purposes.
-
Constructor Details
-
Face
Creates a new face with the specified vertices that is part of the 3Downerobject. Most faces will have at least three vertices, but a special case with just two vertices (representing a line) is permitted.- Parameters:
owner- the object that owns the face (nullnot permitted).vertices- the indices of the vertices (array length >= 2).- Since:
- 1.3
-
-
Method Details
-
getOwner
Returns the object that this face belongs too (as passed to the constructor).- Returns:
- The owner (never
null). - Since:
- 1.3
-
getOffset
Returns the offset to add to the vertex indices.- Returns:
- The offset.
-
setOffset
Sets the offset to add to the vertex indices.- Parameters:
offset- the offset.
-
getVertexCount
Returns the number of vertices in this face.- Returns:
- The number of vertices in this face.
-
getVertexIndex
Returns the index for the specified vertex.- Parameters:
i- the vertex index.- Returns:
- The index.
-
getColor
A convenience method that looks up and returns the color for this face (obtained by querying the object that owns the face). The color is not stored as an attribute of the face, because typically an object has many faces that are all the same color.- Returns:
- The color (never
null).
-
getOutline
Returnstrueif an outline should be drawn for this face, andfalseotherwise. The value is obtained by querying the object that owns the face.- Returns:
- A boolean.
-
getTag
Returns the tag for this face (alwaysnullfor this class, subclasses may override). TheTaggedFaceclass overrides this method.- Returns:
null.- Since:
- 1.3
-
calculateNormal
Calculates the normal vector for this face.- Parameters:
points- the vertices of the object that this face belongs to (these can be in world or eye coordinates).- Returns:
- The normal vector.
-
calculateAverageZValue
Returns the average z-value.- Parameters:
points- the points.- Returns:
- The average z-value.
-
isFrontFacing
Returnstrueif this face is front facing, andfalseotherwise.- Parameters:
projPts- the projection points.- Returns:
- A boolean.
-
createPath
Creates and returns a path for the outline of this face.- Parameters:
pts- the projected points for the world (nullnot permitted).- Returns:
- A path.
- Since:
- 1.3
-
toString
Returns a string representation of this instance, primarily for debugging purposes.
-