public class SceneGraphPath extends Object
In the array of internal nodes, the node at index 0 is the node closest to the Locale. The indices increase along the path to the terminal node, with the node at index length-1 being the node closest to the terminal node. The array of nodes does not contain either the Locale (which is not a node) or the terminal node.
When a SceneGraphPath is returned from the picking or collision methods of Java 3D, it will also contain the value of the LocalToVworld transform of the terminal node that was in effect at the time the pick or collision occurred. Note that ENABLE_PICK_REPORTING and ENABLE_COLLISION_REPORTING are disabled by default. This means that the picking and collision methods will return the minimal SceneGraphPath by default.
Constructor and Description |
---|
SceneGraphPath()
Constructs a SceneGraphPath object with default parameters.
|
SceneGraphPath(Locale root,
Node object)
Constructs a new SceneGraphPath object.
|
SceneGraphPath(Locale root,
Node[] nodes,
Node object)
Constructs a new SceneGraphPath object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o1)
Returns true if the Object o1 is of type SceneGraphPath and all of the
data members of o1 are equal to the corresponding data members in
this SceneGraphPath and if the values of the transforms is equal.
|
boolean |
equals(SceneGraphPath testPath)
Returns true if all of the data members of path testPath are
equal to the corresponding data members in this SceneGraphPath and
if the values of the transforms is equal.
|
Locale |
getLocale()
Retrieves the path's Locale
|
Node |
getNode(int index)
Retrieves the node at the specified index.
|
Node |
getObject()
Retrieves the path's terminal node object.
|
Transform3D |
getTransform()
Returns a copy of the transform associated with this SceneGraphPath;
returns null if there is no transform associated.
|
int |
hashCode()
Returns a hash number based on the data values in this
object.
|
boolean |
isSamePath(SceneGraphPath testPath)
Determines whether two SceneGraphPath objects represent the same
path in the scene graph; either object might include a different
subset of internal nodes; only the internal link nodes, the Locale,
and the Node itself are compared.
|
int |
nodeCount()
Retrieves the number of nodes in this path.
|
void |
set(SceneGraphPath newPath)
Sets this path's values to that of the specified path.
|
void |
setLocale(Locale newLocale)
Sets this path's Locale to the specified Locale.
|
void |
setNode(int index,
Node newNode)
Replaces the node at the specified index with newNode.
|
void |
setNodes(Node[] nodes)
Sets this path's node objects to the specified node objects.
|
void |
setObject(Node object)
Sets this path's terminal node to the specified node object.
|
void |
setTransform(Transform3D trans)
Sets the transform component of this SceneGraphPath to the value of
the passed transform.
|
String |
toString()
Returns a string representation of this object;
the string contains the class names of all Nodes in the SceneGraphPath,
the toString() method of any associated user data provided by
SceneGraphObject.getUserData(), and also prints out the transform,
if it is not null.
|
public SceneGraphPath()
public SceneGraphPath(Locale root, Node object)
root
- the Locale object of this pathobject
- the terminal node of this pathpublic final void set(SceneGraphPath newPath)
newPath
- the SceneGraphPath to copypublic final void setLocale(Locale newLocale)
newLocale
- The new Localepublic final void setObject(Node object)
object
- the new terminal nodepublic final void setNodes(Node[] nodes)
nodes
- an array of node objects in the path from
the Locale to the terminal nodepublic final void setNode(int index, Node newNode)
index
- the index of the node to replacenewNode
- the new nodeNullPointerException
- if the node array pointer is null.public final void setTransform(Transform3D trans)
trans
- the transform to be copied. trans should be the
localToVworld matrix of this SceneGraphPath object.public final Transform3D getTransform()
public final Locale getLocale()
public final Node getObject()
public final int nodeCount()
public final Node getNode(int index)
index
- the index specifying which node to retrievepublic boolean equals(SceneGraphPath testPath)
testPath
- the path we will compare this object's path against.public boolean equals(Object o1)
public int hashCode()
public final boolean isSamePath(SceneGraphPath testPath)
testPath
- the SceneGraphPath to be compared to this SceneGraphPathpublic String toString()
Copyright © 2016–2022 SciJava. All rights reserved.