gumbo.graphic.space
Interface TransformNode

All Superinterfaces:
Graphic, SpaceNode
All Known Subinterfaces:
AxisLayoutGraphic, MatrixTransformNode, RigidTransformNode, RotationNode, ScaleNode, TranslationNode
All Known Implementing Classes:
SwingShape, SwingSpaceNode

public interface TransformNode
extends SpaceNode

A base interface for space nodes that perform a spatial transform, in a stateful manner. The transform occurs in one of two ways. If this is a "space transforming" node the transform affects its local space. As such, the bounds and intersection of its contents, which are defined relative to the local space, are not affected by the transform (the space has changed, not the contents relative to the space). if this is a "contents transforming" node the transform affects its contents (geometry and children), not its local space. As such, the bounds and intersection of its contents are affected by the transform.

In other words, the transform in a space transforming node occurs "outside" the node, and that of a content transforming node occurs "inside" of it. In terms of implementation, this distinction is important. When the transform changes in a space transform node the node's content geometry and bounds are unaffected. However, when the transform changes in a contents transform node, the node must update its content geometry and recompute its bound based on the transformed geometry and that of its child nodes.

In general, geometry in a space below this transform node is transformed to a space above it in the space tree by pre-multiplying the geometry by the matrix equivalent of this node's transform. Specifics are another matter. If this is a space transform node, pre-multiplication by this node's transform is not needed to go from a child's space to the local space, but it is needed to go from the local space to the parent's space. If this is a contents transform node, the reverse is true, with pre-multiplication by this node's transform needed to go from a child's space to the local space, but not to go from the local space to the parent's space.

Space nodes that are not transform nodes can defer to their closest ancestor transform node or the root node for their reference space. If transform node subinterfaces are combined (such as translation, rotation, and scaling), the order in which they apply and the conditions under which they are valid must be defined to avoid ambiguities.

Version:
$Revision: 1.1 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Method Summary
 Matrix4 getGraphicTransform(Matrix4 retVal)
          Returns a matrix describing the transform state of this node.
 boolean isSpaceTransforming()
          Returns true if this is a space transforming node (transforms its local space, leaving its contents unchanged), and false if it is content transforming (transforms its contents, leaving its local space unchanged).
 
Methods inherited from interface gumbo.graphic.space.SpaceNode
getGraphicSpaceTree
 
Methods inherited from interface gumbo.graphic.Graphic
getGraphic
 

Method Detail

isSpaceTransforming

public boolean isSpaceTransforming()
Returns true if this is a space transforming node (transforms its local space, leaving its contents unchanged), and false if it is content transforming (transforms its contents, leaving its local space unchanged).

Returns:
The transform node type.

getGraphicTransform

public Matrix4 getGraphicTransform(Matrix4 retVal)
Returns a matrix describing the transform state of this node. If this is a space transforming node, pre-multiplying geometry in the local space by this matrix transforms it to the parent node's local space (or absolute space if this node is a root). If this is a contents transforming node, pre-multiply geometry in a child node's local space by this matrix transforms it to the local space.

Parameters:
retVal - Return value object. The matrix. Never null.
Returns:
Reference to retVal. Never null.