SOANTISQUISH(3iv)

πŸ’– SoAntiSquish πŸ’–

okay bestie, welcome to the SoAntiSquish(3IV) page β€” yes that's the manual name, we're keeping it, it's part of the lore 🫢


✨ NAME ✨

SoAntiSquish β€” a transformation node that undoes non-uniform 3D scales. literally its whole job. it un-squishes. iconic behaviour honestly πŸŽ€


🌸 INHERITS FROM 🌸

SoBase > SoFieldContainer > SoNode > SoTransformation > SoAntiSquish

so it's a whole lineage of nodes and it's at the bottom of the family tree, main character energy, slay πŸ‘‘


πŸ’… SYNOPSIS πŸ’…

#include <Inventor/nodes/SoAntiSquish.h>

the Sizing enum (this is the good part)

enum Sizing {
     SoAntiSquish::X     fits the other two axes to match the X axis,
                              whose size is unchanged
     SoAntiSquish::Y     fits the other two axes to match the Y axis,
                              whose size is unchanged
     SoAntiSquish::Z     fits the other two axes to match the Z axis,
                              whose size is unchanged
     SoAntiSquish::AVERAGE_DIMENSION
                         uses average of 3 scales in the matrix
     SoAntiSquish::BIGGEST_DIMENSION
                         uses biggest of 3 scales in the matrix
     SoAntiSquish::SMALLEST_DIMENSION
                         uses smallest of 3 scales in the matrix
     SoAntiSquish::LONGEST_DIAGONAL
                         accounts for shearing; transforms a cube by the
                              matrix and then uses length of longest
                              diagonal
}

ok so like: pick a whole axis and let it stay exactly as-is while the other two get fitted to it (X, Y, Z), OR pick a vibe from the three scales β€” average (AVERAGE_DIMENSION), biggest (BIGGEST_DIMENSION), smallest (SMALLEST_DIMENSION) β€” OR go full overachiever and use LONGEST_DIAGONAL, which actually accounts for shearing by transforming a cube with the matrix and then taking the length of the longest diagonal. she's thorough πŸ’…

Fields from class SoAntiSquish

SoSFEnum            sizing
SoSFBool            recalcAlways

Methods from class SoAntiSquish

                     SoAntiSquish()
static SoType       getClassTypeId()
void                recalc()

Methods from class SoNode

void                setOverride(SbBool state)
SbBool              isOverride() const
SoNode *            copy(SbBool copyConnections = FALSE) const
virtual SbBool      affectsState() const
static SoNode *     getByName(const SbName &name)
static int          getByName(const SbName &name, SoNodeList &list)

Methods from class SoFieldContainer

void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool
                         copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName)
                         const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

Methods from class SoBase

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so picture this: when an action traverses this node, it removes the nonuniform 3D scaling from the current transformation matrix. that's it, that's the gig ✨

it's used by draggers like SoTrackballDragger that need to stay uniformly scaled no matter where they're chilling in the scene graph. like, no matter what cursed non-uniform scaling the ancestors did, these draggers stay proportioned. bestie said "not on my watch" 😭

the magnitude of the new scale comes from the current transformation matrix plus the sizing field. and important: this node does not touch the translation or rotation in the matrix. only the scale. respect the boundaries 🫢


πŸŽ€ FIELDS πŸŽ€

  • SoSFEnum sizing β€” picks which of the algorithms in the Sizing type gets used to choose the new scale when the x, y, and z scales aren't all equal. this is the "how do we un-squish" dial, iykyk πŸ’œ
  • SoSFBool recalcAlways β€” if recalcAlways is TRUE, this node recalculates its unsquishing matrix every single time it's traversed. if it's FALSE, then it only does that during the first traversal after a call to recalc(). so like, lazy mode vs. always-fresh mode 🌈

⭐ METHODS ⭐

                     SoAntiSquish()

creates an anti-squish node with default settings. brand new baby node, fresh out the box πŸ“

static SoType       getClassTypeId()

returns the type identifier for this class. classic.

void                recalc()

sets a flag so that the next time this node gets traversed, it recalculates its unsquishing matrix. lowkey a "hey, do the thing again next time" button πŸ’…


πŸ”₯ ACTION BEHAVIOR πŸ”₯

SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoGetMatrixAction, SoRayPickAction

appends the current transformation with a new matrix to create an unsquished result. no cap, that's all these actions get up to here 🌟


πŸ’– FILE FORMAT/DEFAULTS πŸ’–

AntiSquish {
    sizing        AVERAGE_DIMENSION
    recalcAlways  TRUE
}

so the defaults are AVERAGE_DIMENSION for sizing and TRUE for recalcAlways. periodt πŸ’…


🌈 SEE ALSO 🌈

SoCenterballDragger, SoJackDragger, SoTrackballDragger, SoTransformerDragger, SoTransformation, SoTransformBoxDragger

go read those next bestie, they're all in the dragger cinematic universe πŸ‘‘


and that's a wrap! this was SoAntiSquish(3IV)() from the SoAntiSquish(3IV)() manual β€” version/date tag included, don't @ me, go un-squish something πŸ’–βœ¨πŸ¦‹