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 TypeMethodDescriptionfloat
calculateAverageZValue
(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).int
Returns the offset to add to the vertex indices.boolean
Returnstrue
if an outline should be drawn for this face, andfalse
otherwise.getOwner()
Returns the object that this face belongs too (as passed to the constructor).getTag()
Returns the tag for this face (alwaysnull
for this class, subclasses may override).int
Returns the number of vertices in this face.int
getVertexIndex
(int i) Returns the index for the specified vertex.boolean
isFrontFacing
(Point2D[] projPts) Returnstrue
if this face is front facing, andfalse
otherwise.void
setOffset
(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 3Downer
object. 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 (null
not 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
Returnstrue
if an outline should be drawn for this face, andfalse
otherwise. The value is obtained by querying the object that owns the face.- Returns:
- A boolean.
-
getTag
Returns the tag for this face (alwaysnull
for this class, subclasses may override). TheTaggedFace
class 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
Returnstrue
if this face is front facing, andfalse
otherwise.- 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 (null
not permitted).- Returns:
- A path.
- Since:
- 1.3
-
toString
Returns a string representation of this instance, primarily for debugging purposes.
-