public class Object3D extends java.lang.Object
ViewPoint3D is provided.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_KEY
The key for storing the object class as an optional property for this
object.
|
static java.lang.String |
COLOR_PREFIX
A prefix used for setting color properties for an object.
|
static java.lang.String |
ITEM_KEY
The key for storing item keys as property values.
|
| Constructor and Description |
|---|
Object3D(java.awt.Color color)
Creates a new object, initially with no vertices or faces.
|
Object3D(java.awt.Color color,
boolean outline)
Creates a new object, initially with no vertices or faces.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDoubleSidedFace(int[] vertices)
Adds a double-sided face for the given vertices (specified by index
value) and color.
|
void |
addFace(Face face)
Adds a face for this object.
|
void |
addFace(int[] vertices)
Adds a face for the given vertices (specified by index value).
|
void |
addFace(int[] vertices,
java.lang.String tag)
Adds a tagged face for the given vertices (specified by index value).
|
void |
addVertex(double x,
double y,
double z)
Adds a new object vertex with the specified coordinates.
|
void |
addVertex(Point3D vertex)
Adds a new object vertex.
|
Point3D[] |
calculateEyeCoordinates(ViewPoint3D viewPoint)
Returns the eye coordinates of the object's vertices.
|
java.awt.geom.Point2D[] |
calculateProjectedPoints(ViewPoint3D viewPoint,
double d)
Calculates the projected points for the object's vertices, for the
given viewpoint.
|
static Object3D |
createBar(double xWidth,
double zWidth,
double x,
double y,
double z,
double zero,
java.awt.Color barColor,
java.awt.Color baseColor,
java.awt.Color topColor,
boolean inverted)
Creates a bar with the specified dimensions and color.
|
static Object3D |
createBox(double x,
double xdim,
double y,
double ydim,
double z,
double zdim,
java.awt.Color color)
Creates a box centered on
(x, y, z) with the specified
dimensions. |
static Object3D |
createCube(double size,
double x,
double y,
double z,
java.awt.Color color)
Creates a cube centered on
(x, y, z) with the specified
size. |
static Object3D |
createLabelObject(java.lang.String label,
java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color bgColor,
double x,
double y,
double z,
boolean reversed,
boolean doubleSided)
Creates a label object, which has a single transparent face in the
Z-plane plus associated label attributes.
|
static Object3D |
createOctahedron(double size,
double xOffset,
double yOffset,
double zOffset,
java.awt.Color color)
Creates an octahedron.
|
static java.util.List<Object3D> |
createPieLabelMarkers(double radius,
double explodeRadius,
double base,
double height,
double angle1,
double angle2)
Returns two 3D objects (sheets in the y-plane) that can be used as
alignment anchors for the labels of a pie segment.
|
static Object3D |
createPieSegment(double radius,
double explodeRadius,
double base,
double height,
double angle1,
double angle2,
double inc,
java.awt.Color color)
Creates a pie segment with the specified attributes.
|
static Object3D |
createSphere(double radius,
int n,
double x,
double y,
double z,
java.awt.Color extColor,
java.awt.Color intColor)
Creates an approximation of a sphere.
|
static Object3D |
createTetrahedron(double size,
double xOffset,
double yOffset,
double zOffset,
java.awt.Color color)
Creates a tetrahedron.
|
static Object3D |
createYSheet(double size,
double x,
double y,
double z,
java.awt.Color color,
boolean invert)
Creates a square flat surface in the x-z plane (constant y) with a
single face.
|
static Object3D |
createZSheet(double size,
double x,
double y,
double z,
java.awt.Color color)
Creates a square flat surface in the x-y plane (constant z).
|
java.awt.Color |
getColor()
Returns the default face color as specified in the constructor.
|
java.awt.Color |
getColor(Face face)
Returns the color for a specific face.
|
int |
getFaceCount()
Returns the number of faces.
|
java.util.List<Face> |
getFaces()
Returns the faces for this object.
|
boolean |
getOutline()
Returns the outline flag.
|
boolean |
getOutline(Face face)
Returns
true if an outline should be drawn for the
specified face, and false otherwise. |
java.lang.Object |
getProperty(java.lang.String key)
Returns the value of the property with the specified key, or
null if there is no property defined for that key. |
int |
getVertexCount()
Returns the number of vertices for this object.
|
void |
setOutline(boolean outline)
Sets the outline flag.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets the value of a property, overwriting any existing value.
|
public static final java.lang.String CLASS_KEY
public static final java.lang.String ITEM_KEY
public static final java.lang.String COLOR_PREFIX
public Object3D(java.awt.Color color)
color - the default face color (null not permitted).public Object3D(java.awt.Color color, boolean outline)
color - the default face color (null not permitted).outline - the default flag that determines whether face outlines
are drawn.public java.awt.Color getColor()
null).public boolean getOutline()
public void setOutline(boolean outline)
outline - the new flag value.public java.lang.Object getProperty(java.lang.String key)
null if there is no property defined for that key.key - the property key (null not permitted).null).public void setProperty(java.lang.String key, java.lang.Object value)
ITEM_KEY).key - the key (null not permitted).value - the value (null permitted).public java.awt.Color getColor(Face face)
face - the face (null not permitted).null).public boolean getOutline(Face face)
true if an outline should be drawn for the
specified face, and false otherwise.face - the face (null not permitted).public int getVertexCount()
public void addVertex(double x, double y, double z)
x - the x-coordinate.y - the y-coordinate.z - the z-coordinate.public void addVertex(Point3D vertex)
vertex - the vertex (null not permitted).public int getFaceCount()
public void addFace(int[] vertices)
vertices - the vertices (all should lie in a plane).public void addFace(int[] vertices, java.lang.String tag)
vertices - the vertices (all should lie in a plane).tag - the tag (null not permitted).public void addDoubleSidedFace(int[] vertices)
vertices - the vertices (all should lie in a plane).public void addFace(Face face)
face - the face (null not permitted).public java.util.List<Face> getFaces()
Object3D
instance, so callers should take care not to modify this list
unintentionally.public java.awt.geom.Point2D[] calculateProjectedPoints(ViewPoint3D viewPoint, double d)
viewPoint - the view point (null not permitted).d - the projection distance.public Point3D[] calculateEyeCoordinates(ViewPoint3D viewPoint)
viewPoint - the view point (null not permitted).public static Object3D createYSheet(double size, double x, double y, double z, java.awt.Color color, boolean invert)
size - the sheet size.x - the x-coordinate for the center of the square.y - the y-coordinate.z - the z-coordinate for the center of the square.color - the color (null not permitted).invert - invert the order of the facepublic static Object3D createZSheet(double size, double x, double y, double z, java.awt.Color color)
size - the sheet size.x - the x-coordinate of a point on the surface.y - the y-coordinate of a point on the surface.z - the z-coordinate of a point on the surface.color - the color.public static Object3D createCube(double size, double x, double y, double z, java.awt.Color color)
(x, y, z) with the specified
size.size - the size.x - the x-offset.y - the y-offset.z - the z-offset.color - the color (null not permitted).null).public static Object3D createBox(double x, double xdim, double y, double ydim, double z, double zdim, java.awt.Color color)
(x, y, z) with the specified
dimensions.x - the x-coordinate.xdim - the length of the box in the x-dimension.y - the y-coordinate.ydim - the length of the box in the y-dimension.z - the z-coordinate.zdim - the length of the box in the y-dimension.color - the color (null not permitted).null).createCube(double, double, double, double, java.awt.Color)public static Object3D createTetrahedron(double size, double xOffset, double yOffset, double zOffset, java.awt.Color color)
size - the size.xOffset - the x-offset.yOffset - the y-offset.zOffset - the z-offset.color - the color (null not permitted).public static Object3D createOctahedron(double size, double xOffset, double yOffset, double zOffset, java.awt.Color color)
size - the size.xOffset - the x-offset.yOffset - the y-offset.zOffset - the z-offset.color - the color (null not permitted).public static Object3D createSphere(double radius, int n, double x, double y, double z, java.awt.Color extColor, java.awt.Color intColor)
radius - the radius of the sphere (in world units).n - the number of layers.x - the x-coordinate of the center of the sphere.y - the y-coordinate of the center of the sphere.z - the z-coordinate of the center of the sphere.extColor - the exterior color (null not permitted).intColor - the interior color (null not permitted).public static Object3D createPieSegment(double radius, double explodeRadius, double base, double height, double angle1, double angle2, double inc, java.awt.Color color)
radius - the radius.explodeRadius - the explode radius (0.0 if not exploded).base - the base.height - the height.angle1 - the start angle (radians).angle2 - the end angle (radians).inc - the increment.color - the color (null not permitted).public static java.util.List<Object3D> createPieLabelMarkers(double radius, double explodeRadius, double base, double height, double angle1, double angle2)
radius - the pie segment radius (in world units).explodeRadius - the pie segment explode radius (in world units).base - the base of the pie segment.height - the height of the pie segment.angle1 - the start angle of the segment (in radians).angle2 - the end angle of the segment (in radians).public static Object3D createBar(double xWidth, double zWidth, double x, double y, double z, double zero, java.awt.Color barColor, java.awt.Color baseColor, java.awt.Color topColor, boolean inverted)
xWidth - the x-width of the bar.zWidth - the z-width (or depth) of the bar.x - the x-coordinate for the center of the bar.y - the y-coordinate for the top of the bar.z - the z-coordinate for the center of the bar.zero - the y-coordinate for the bottom of the bar.barColor - the color for the bar (null not permitted).baseColor - the color for the base of the bar (if null,
the color is used instead).topColor - the color for the top of the bar (if
null, the color is used instead).inverted - a flag that determines whether the baseColor and
topColor should be swapped in their usage.public static Object3D createLabelObject(java.lang.String label, java.awt.Font font, java.awt.Color fgColor, java.awt.Color bgColor, double x, double y, double z, boolean reversed, boolean doubleSided)
label - the label (null not permitted).font - the font (null not permitted).fgColor - the label foreground color (null not permitted).bgColor - the label background color (null not permitted).x - the x-coordinate in 3D space.y - the y-coordinate in 3D space.z - the z-coordinate in 3D space.reversed - reverse the order of the vertices?doubleSided - is the face double-sided (visible from either side)?null).