public class SceneGraphPath extends Object implements Cloneable
SceneGraphNode
contained
in the final SceneGraphComponent.
This allows addressing the sub-nodes contained as fields in the SceneGraphComponent (such as lights, camera, geometry, appearance). But it is not required that the path ends in such a SceneGraphNode; it can also end in a SceneGraphComponent.
There are methods for pushing and popping elements onto the path, useful for instances
of SceneGraphVisitor
.
There are methods for ascertaining the matrix transformation associated to the path
(by multiplying the instances of Transformation
occurring on the path.
Note: This class takes no care of the elements being inserted. The method isValid()
gives information if this path exists in the scenegraph
This class does not allow specifying a path that begins somewhere in a scene graph, goes up to the root, and then descends again. All paths go down from the root.
The methods equal() and hashCode() always represent the current state of the path, so make sure you do not change paths that are put into some sort of HashMap etc.!
Constructor and Description |
---|
SceneGraphPath() |
SceneGraphPath(SceneGraphNode... nodes)
A constructor which allows a list of
SceneGraphComponent 's as initialization information. |
SceneGraphPath(SceneGraphPath path)
A so-called copy constructor.
|
public SceneGraphPath()
public SceneGraphPath(SceneGraphPath path)
path
- public SceneGraphPath(SceneGraphNode... nodes)
SceneGraphComponent
's as initialization information.nodes
- public static SceneGraphPath fromList(List<SceneGraphNode> list)
public Object clone()
SceneGraphPath(SceneGraphPath)
insteadpublic List<SceneGraphNode> toList()
public ListIterator<SceneGraphNode> iterator()
public ListIterator<SceneGraphNode> iterator(int start)
public Iterator<SceneGraphNode> reverseIterator(int start)
start
- how many nodes from the end of the path should we leave out?
i.e.: p.reverseIterator(p.getLength()) gives the same result as p.reverseIterator()public Iterator<SceneGraphNode> reverseIterator()
public int getLength()
public final void push(SceneGraphNode c)
public final SceneGraphPath pushNew(SceneGraphNode c)
public final void pop()
public final SceneGraphPath popNew()
public boolean contains(SceneGraphNode n)
public SceneGraphNode getFirstElement()
public SceneGraphNode getLastElement()
public SceneGraphComponent getLastComponent()
public void clear()
public SceneGraphNode get(int n)
public void replace(SceneGraphNode old, SceneGraphNode nnew)
public void insertAfter(SceneGraphNode toInsert, SceneGraphNode exists)
public boolean isValid()
public boolean isEqual(SceneGraphPath anotherPath)
public boolean startsWith(SceneGraphPath potentialPrefix)
public double[] getMatrix(double[] aMatrix)
public double[] getMatrix(double[] aMatrix, int begin)
public double[] getInverseMatrix(double[] invMatrix)
public double[] getInverseMatrix(double[] invMatrix, int begin)
public double[] getMatrix(double[] aMatrix, int begin, int end)
public double[] getInverseMatrix(double[] aMatrix, int begin, int end)