SOGETMATRIXACTION(3iv)

πŸ’– SoGetMatrixAction πŸ’–

okay bestie, we're reading the SoGetMatrixAction(3IV) manual page together and honestly? it's giving math girlie main character energy. no cap. let's go πŸ¦‹


✨ NAME ✨

SoGetMatrixAction β€” computes transformation matrix for subgraph πŸ’…

🌸 INHERITS FROM 🌸

SoAction > SoGetMatrixAction

(yes she's a SoAction descendant, we love a legacy queen πŸ‘‘)


✨ SYNOPSIS ✨

#include <Inventor/actions/SoGetMatrixAction.h>

Methods from class SoGetMatrixAction:

                          SoGetMatrixAction(const SbViewportRegion
                               &newRegion)
void                      setViewportRegion(const SbViewportRegion
                               &newRegion)
const SbViewportRegion &  getViewportRegion() const
SbMatrix &                getMatrix()
SbMatrix &                getInverse()
SbMatrix &                getTextureMatrix()
SbMatrix &                getTextureInverse()

Methods from class SoAction:

virtual void        apply(SoNode *node)
virtual void        apply(SoPath *path)
virtual void        apply(const SoPathList &pathList, SbBool obeysRules =
                         FALSE)
static SoType       getClassTypeId()
virtual SoType      getTypeId()
virtual SbBool      isOfType(SoType type)
virtual void        invalidateState()

✨ DESCRIPTION ✨

So this action computes transformation matrices for a given subgraph. She hands you the cumulative transformation matrix AND its inverse, plus a cumulative texture transformation matrix AND its inverse. four matrices. iconic. πŸŽ€

Now here's the thing that makes her lowkey different from every other action: she does NOT traverse downwards from groups. When you apply her to a node, she computes the matrix for just that node. (Which, ngl, makes sense for transformation nodes, but for other nodes? not really, bestie, it's giving "why are we here". πŸ™ˆ)

She's way more useful when you apply her to a path. When applied to a path, she gathers up the transformation info for all the nodes in the path and those that affect nodes in the path β€” but then she STOPS when she hits the last node in the path. she does not traverse downwards from it like other actions (such as rendering) do. and honestly? this behavior makes the most sense for this action. periodt. πŸ’…


✨ METHODS ✨

  • SoGetMatrixAction(const SbViewportRegion &newRegion) β€” the constructor, and it takes the viewport region to use for picking. now listen, even though the matrix computation may not involve a window per se, some nodes genuinely need this info to figure out their placement. so give her the region, she'll handle it. 🫢
  • void setViewportRegion(const SbViewportRegion &newRegion)
  • const SbViewportRegion & getViewportRegion() const β€” sets / returns the current viewport region to use for the action. getter and setter, a matched pair, we love to see it. ✨
  • SbMatrix & getMatrix()
  • SbMatrix & getInverse() β€” returns the cumulative transformation matrix and its inverse.
⚠️ WARNING: the matrices returned by these routines should not be changed (unless you are implementing your own transformation nodes). do not touch. hands off. πŸ’€
  • SbMatrix & getTextureMatrix()
  • SbMatrix & getTextureInverse() β€” returns the cumulative texture transformation matrix and its inverse.
⚠️ WARNING: same deal, bestie β€” the matrices returned by these routines should not be changed (unless you are implementing your own transformation nodes). leave them alone fr fr. 😭

🌈 SEE ALSO 🌈

  • SoGetBoundingBoxAction

and that's the whole page, mwah πŸ’‹ she's SoGetMatrixAction(3IV)(), the manual page, dropping as ever β€” go forth and compute those matrices responsibly, bestie, and remember: look, don't touch those returned matrices πŸ’œβœ¨