Class SoGetMatrixAction
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.actions.SoAction
-
- com.openinventor.inventor.actions.SoGetMatrixAction
-
public class SoGetMatrixAction extends SoAction
Computes transformation matrix for a subgraph. This action computes transformation matrices for a given subgraph. It computes the cumulative transformation matrix and its inverse, along with a cumulative texture transformation matrix and its inverse. The cumulative transformation matrix transforms the coordinates of a shape from the local object coordinate system to the global world coordinate system.When this action is applied to a node, it computes the matrix for just that node. This is currently the easiest way to get the transformation matrix for an
SoTransform
node. It's not very useful for most other types of nodes.The most common scenario is applying this action to a path. In that case it gathers the transformation info for all nodes in the path and those that affect nodes in the path, but it stops when it hits the last node in the path; it does not traverse downwards from it as most other actions (such as rendering) do. This behavior makes the most sense for this action. To get a path to, for example, a specific geometry in the scene graph see
SoSearchAction
.Sets:
SoViewportRegionElement
EXAMPLE // Get cumulative matrix using current viewport on screen SoPath somePath = ... SoGetMatrixAction gma = new SoGetMatrixAction( viewer.getArea().getViewportRegion() ); gma.apply( somePath ); SbMatrix matrix = gma.getMatrix(); - See Also:
SoGetBoundingBoxAction
,SoSearchAction
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.actions.SoAction
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoGetMatrixAction(SbViewportRegion newRegion)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
SbMatrix
getInverse()
Returns the inverse of the cumulative transformation matrix.SbMatrix
getMatrix()
Returns cumulative transformation matrix.SbMatrix
getTextureInverse()
Returns the inverse of the cumulative texture transformation matrix.SbMatrix
getTextureMatrix()
Returns cumulative texture transformation matrix.SbViewportRegion
getViewportRegion()
Returns current viewport region to use for action.void
setViewportRegion(SbViewportRegion newRegion)
Sets current viewport region to use for action.-
Methods inherited from class com.openinventor.inventor.actions.SoAction
apply, apply, clearApplyResult, forwardTraversal, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getDistribMode, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SoGetMatrixAction
public SoGetMatrixAction(SbViewportRegion newRegion)
Constructor.
Even though the bounding box computation may not involve a window per se, some nodes need the size of the viewport to determine their size in 3D coordinates. For example the size of anSoText2
is a fixed value in device coordinates, but the corresponding size in 3D depends on the current camera.Usually it is convenient to get the actual viewport region from the viewer as shown in the example above. However if the scene graph does not contain any viewport dependent nodes then any values can be used.
-
-
Method Detail
-
getInverse
public SbMatrix getInverse()
Returns the inverse of the cumulative transformation matrix. Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
-
getTextureInverse
public SbMatrix getTextureInverse()
Returns the inverse of the cumulative texture transformation matrix. Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
-
getMatrix
public SbMatrix getMatrix()
Returns cumulative transformation matrix. Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
-
getTextureMatrix
public SbMatrix getTextureMatrix()
Returns cumulative texture transformation matrix. Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
-
enableElement
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
-
setViewportRegion
public void setViewportRegion(SbViewportRegion newRegion)
Sets current viewport region to use for action.
-
getViewportRegion
public SbViewportRegion getViewportRegion()
Returns current viewport region to use for action.
-
-