/** * Gets an array of nodes representing the state of this traversal. * Nodes in the array are ordered from parent to child. The last node * in the array is the current node, the next to last node is the * current node's parent, and so on. * @return the array of nodes. */ public Node[] getNodes() { int nnode = _nodeStack.size(); Node[] nodes = new Node[nnode]; for (int inode=0; inode<nnode; ++inode) nodes[inode] = _nodeStack.get(inode); return nodes; }
/** * Gets the current node in this traversal. * @return the current node. */ public Node getNode() { return _nodeStack.peek(); }
/** * Restores the most recently saved (pushed) node. * Discards the current node. */ public void popNode() { _nodeStack.pop(); }
/** * Saves the current node, and then makes the specified node current. * @param node the new current node. */ public void pushNode(Node node) { _nodeStack.push(node); }
/** * Returns the number of current and parent nodes in this traversal. * @return the number of nodes. */ public int countNodes() { return _nodeStack.size(); }
/** * Gets the node in this traversal with specified index. If count is the * number of nodes returned by the method {@link #countNodes()}, then the * current node has index count-1, and the root node has index zero. * <p> * If the specified index is negative, then count is added to the index. * Therefore, the index -1 will get the current node, the index -2 will * get its parent node, and so on. * @param index the index. * @return the node. */ public Node getNode(int index) { if (index<0) { return _nodeStack.get(index+countNodes()); } else { return _nodeStack.get(index); } }
/** * Saves the local-to-world transform before appending a transform. * The specified transform matrix is post-multiplied with the current * local-to-world transform, such that the specified transform is applied * first when transforming local coordinates to world coordinates. * @param transform the transform to append. */ public void pushLocalToWorld(Matrix44 transform) { _localToWorldStack.push(new Matrix44(_localToWorld)); _localToWorld.timesEquals(transform); }
/** * Restores the most recently saved (pushed) local-to-world transform. * Discards the current local-to-world transform. */ public void popLocalToWorld() { _localToWorld = _localToWorldStack.pop(); }
/** * Saves the local-to-world transform before appending a transform. * The specified transform matrix is post-multiplied with the current * local-to-world transform, such that the specified transform is applied * first when transforming local coordinates to world coordinates. * @param transform the transform to append. */ public void pushLocalToWorld(Matrix44 transform) { super.pushLocalToWorld(transform); for (int i=0,plane=1; i<6; ++i,plane<<=1) { // for all planes _planesStack.push(new Plane(_planes[i])); // save plane if ((_active&plane)!=0) // if plane is active _planes[i].transformWithInverse(transform); // transform it } }
/** * Restores the most recently saved (pushed) local-to-world transform. * Discards the current local-to-world transform. */ public void popLocalToWorld() { super.popLocalToWorld(); for (int i=5; i>=0; --i) // for all planes (in reverse order!) _planes[i] = _planesStack.pop(); // restore plane }
/** * Saves the local-to-world transform before appending a transform. * The specified transform matrix is post-multiplied with the current * local-to-world transform, such that the specified transform is applied * first when transforming local coordinates to world coordinates. * @param transform the transform to append. */ public void pushLocalToWorld(Matrix44 transform) { super.pushLocalToWorld(transform); _pickSegmentStack.push(new Segment(_pickSegment)); _pickSegment.transform(transform.inverse()); _nearPoint = _pickSegment.getA(); _farPoint = _pickSegment.getB(); }
/** * Restores the most recently saved (pushed) local-to-world transform. * Discards the current local-to-world transform. */ public void popLocalToWorld() { super.popLocalToWorld(); _pickSegment = _pickSegmentStack.pop(); _nearPoint = _pickSegment.getA(); _farPoint = _pickSegment.getB(); }