public class Shape3D extends Leaf
The list of geometry objects must all be of the same equivalence class, that is, the same basic type of primitive. For subclasses of GeometryArray, all point objects are equivalent, all line objects are equivalent, and all polygon objects are equivalent. For other subclasses of Geometry, only objects of the same subclass are equivalent. The equivalence classes are as follows:
When Shape3D is used with multiple geometry components, Java 3D may choose to use individual geometry bounds instead of the shape's bounds for region of influence operations, such as lighting. For example, the individual characters of a Text3D shape object may be rendered with a different light set.
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_APPEARANCE_OVERRIDE_READ
Specifies that this node allows reading its appearance override
enable flag.
|
static int |
ALLOW_APPEARANCE_OVERRIDE_WRITE
Specifies that this node allows writing its appearance override
enable flag.
|
static int |
ALLOW_APPEARANCE_READ
Specifies that the node allows read access to its appearance
information.
|
static int |
ALLOW_APPEARANCE_WRITE
Specifies that the node allows write access to its appearance
information.
|
static int |
ALLOW_COLLISION_BOUNDS_READ
Specifies that the node allows reading its collision Bounds
|
static int |
ALLOW_COLLISION_BOUNDS_WRITE
Specifies the node allows writing its collision Bounds
|
static int |
ALLOW_GEOMETRY_READ
Specifies that the node allows read access to its geometry information.
|
static int |
ALLOW_GEOMETRY_WRITE
Specifies that the node allows write access to its geometry information.
|
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
Constructor and Description |
---|
Shape3D()
Constructs a Shape3D node with default parameters.
|
Shape3D(Geometry geometry)
Constructs and initializes a Shape3D node with the specified
geometry component and a null appearance component.
|
Shape3D(Geometry geometry,
Appearance appearance)
Constructs and initializes a Shape3D node with the specified
geometry and appearance components.
|
Modifier and Type | Method and Description |
---|---|
void |
addGeometry(Geometry geometry)
Appends the specified geometry component to this Shape3D
node's list of geometry components.
|
Node |
cloneNode(boolean forceDuplicate)
Used to create a new instance of the node.
|
void |
duplicateNode(Node originalNode,
boolean forceDuplicate)
Copies all node information from
originalNode into
the current node. |
Enumeration |
getAllGeometries()
Returns an enumeration of this Shape3D node's list of geometry
components.
|
Appearance |
getAppearance()
Retrieves the appearance component of this shape node.
|
boolean |
getAppearanceOverrideEnable()
Retrieves the appearanceOverrideEnable flag for this node.
|
Bounds |
getBounds()
See parent class for the documentation on getBounds().
|
Bounds |
getCollisionBounds()
Returns the collision bounding object of this node.
|
Geometry |
getGeometry()
Retrieves the geometry component at index 0 from this Shape3D node's
list of geometry components.
|
Geometry |
getGeometry(int index)
Retrieves the geometry component at the specified index from
this Shape3D node's list of geometry components.
|
int |
indexOfGeometry(Geometry geometry)
Retrieves the index of the specified geometry component in
this Shape3D node's list of geometry components.
|
void |
insertGeometry(Geometry geometry,
int index)
Inserts the specified geometry component into this Shape3D
node's list of geometry components at the specified index.
|
boolean |
intersect(SceneGraphPath path,
PickRay pickRay,
double[] dist)
Checks whether the geometry in this shape node intersects with
the specified pickRay.
|
boolean |
intersect(SceneGraphPath path,
PickShape pickShape)
Checks whether the geometry in this shape node intersects with
the specified pickShape.
|
boolean |
intersect(SceneGraphPath path,
PickShape pickShape,
double[] dist)
Checks whether the geometry in this shape node intersects with
the specified pickShape.
|
int |
numGeometries()
Returns the number of geometry components in this Shape3D node's
list of geometry components.
|
void |
removeAllGeometries()
Removes all geometry components from this Shape3D node.
|
void |
removeGeometry(Geometry geometry)
Removes the specified geometry component from this
Shape3D node's list of geometry components.
|
void |
removeGeometry(int index)
Removes the geometry component at the specified index from
this Shape3D node's list of geometry components.
|
void |
setAppearance(Appearance appearance)
Sets the appearance component of this Shape3D node.
|
void |
setAppearanceOverrideEnable(boolean flag)
Sets a flag that indicates whether this node's appearance can
be overridden.
|
void |
setCollisionBounds(Bounds bounds)
Sets the collision bounds of a node.
|
void |
setGeometry(Geometry geometry)
Replaces the geometry component at index 0 in this Shape3D node's
list of geometry components with the specified geometry component.
|
void |
setGeometry(Geometry geometry,
int index)
Replaces the geometry component at the specified index in this
Shape3D node's list of geometry components with the specified
geometry component.
|
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
public static final int ALLOW_GEOMETRY_READ
public static final int ALLOW_GEOMETRY_WRITE
public static final int ALLOW_APPEARANCE_READ
public static final int ALLOW_APPEARANCE_WRITE
public static final int ALLOW_COLLISION_BOUNDS_READ
public static final int ALLOW_COLLISION_BOUNDS_WRITE
public static final int ALLOW_APPEARANCE_OVERRIDE_READ
public static final int ALLOW_APPEARANCE_OVERRIDE_WRITE
public Shape3D()
public Shape3D(Geometry geometry)
geometry
- the geometry component with which to initialize
this shape node.public Shape3D(Geometry geometry, Appearance appearance)
geometry
- the geometry component with which to initialize
this shape nodeappearance
- the appearance component of the shape nodepublic void setCollisionBounds(Bounds bounds)
bounds
- the collision bounding object for a nodeCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Bounds getCollisionBounds()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setGeometry(Geometry geometry)
geometry
- the geometry component to be stored at index 0.IllegalArgumentException
- if the new geometry
component is not of of the same equivalence class as the
existing geometry components.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Geometry getGeometry()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setGeometry(Geometry geometry, int index)
geometry
- the geometry component to be stored at the
specified index.index
- the index of the geometry component to be replaced.IllegalArgumentException
- if the new geometry
component is not of of the same equivalence class as the
existing geometry components.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Geometry getGeometry(int index)
index
- the index of the geometry component to be returned.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void insertGeometry(Geometry geometry, int index)
geometry
- the geometry component to be inserted at the
specified index.index
- the index at which the geometry component is inserted.IllegalArgumentException
- if the new geometry
component is not of of the same equivalence class as the
existing geometry components.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void removeGeometry(int index)
index
- the index of the geometry component to be removed.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Enumeration getAllGeometries()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void addGeometry(Geometry geometry)
geometry
- the geometry component to be appended.IllegalArgumentException
- if the new geometry
component is not of of the same equivalence class as the
existing geometry components.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int numGeometries()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int indexOfGeometry(Geometry geometry)
geometry
- the geometry component to be looked up.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void removeGeometry(Geometry geometry)
geometry
- the geometry component to be removed.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void removeAllGeometries()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setAppearance(Appearance appearance)
appearance
- the new appearance component for this shape nodeCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Appearance getAppearance()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic boolean intersect(SceneGraphPath path, PickShape pickShape)
path
- the SceneGraphPath to this shape nodepickShape
- the PickShape to be intersectedIllegalArgumentException
- if pickShape is a PickPoint.
Java 3D doesn't have spatial information of the surface.
Use PickBounds with BoundingSphere and a small radius, instead.CapabilityNotSetException
- if the Geometry.ALLOW_INTERSECT
capability bit is not set in all of the Geometry objects
referred to by this shape node.public boolean intersect(SceneGraphPath path, PickRay pickRay, double[] dist)
path
- the SceneGraphPath to this shape nodepickRay
- the PickRay to be intersecteddist
- the closest distance of the intersectionCapabilityNotSetException
- if the Geometry.ALLOW_INTERSECT
capability bit is not set in all of the Geometry objects
referred to by this shape node.public boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist)
path
- the SceneGraphPath to this shape nodepickShape
- the PickShape to be intersecteddist
- the closest distance of the intersectionIllegalArgumentException
- if pickShape is a PickPoint.
Java 3D doesn't have spatial information of the surface.
Use PickBounds with BoundingSphere and a small radius, instead.CapabilityNotSetException
- if the Geometry.ALLOW_INTERSECT
capability bit is not set in all of the Geometry objects
referred to by this shape node.public void setAppearanceOverrideEnable(boolean flag)
flag
- the apperance override enable flag.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphAlternateAppearance
public boolean getAppearanceOverrideEnable()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Node cloneNode(boolean forceDuplicate)
cloneTree
to duplicate the current node.
cloneNode
should be overridden by any user subclassed
objects. All subclasses must have their cloneNode
method consist of the following lines:
public Node cloneNode(boolean forceDuplicate) { UserSubClass usc = new UserSubClass(); usc.duplicateNode(this, forceDuplicate); return usc; }
cloneNode
in class Node
forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.Node.cloneTree()
,
Node.duplicateNode(org.scijava.java3d.Node, boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
public void duplicateNode(Node originalNode, boolean forceDuplicate)
originalNode
into
the current node. This method is called from the
cloneNode
method which is, in turn, called by the
cloneTree
method.
For any NodeComponent
objects
contained by the object being duplicated, each NodeComponent
object's duplicateOnCloneTree
value is used to determine
whether the NodeComponent
should be duplicated in the new node
or if just a reference to the current node should be placed in the
new node. This flag can be overridden by setting the
forceDuplicate
parameter in the cloneTree
method to true
.
NOTE: Applications should not call this method directly.
It should only be called by the cloneNode method.
duplicateNode
in class Node
originalNode
- the original node to duplicate.forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.ClassCastException
- if originalNode is not an instance of
Shape3D
Node.cloneTree()
,
Node.cloneNode(boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
Copyright © 2016–2022 SciJava. All rights reserved.