SOUNITS(3iv)

πŸ’– SoUnits β€” the manual page, but make it make sense πŸ’–

okay bestie, buckle up, we're doing SoUnits(3IV) β€” yes that's the whole manual name, and yes it's giving "3D graphics library that predates your birth" energy, but trust me, it slays. πŸ¦‹


✨ NAME ✨

SoUnits β€” node that scales to convert units of length πŸ“βœ¨


🌸 INHERITS FROM 🌸

SoBase > SoFieldContainer > SoNode > SoTransformation > SoUnits

so basically it's the great-great-great-grandchild of SoBase and it inherited the whole family tree, no cap. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/nodes/SoUnits.h>

enum Units {
     SoUnits::METERS
     SoUnits::CENTIMETERS
     SoUnits::MILLIMETERS
     SoUnits::MICROMETERS
     SoUnits::MICRONS
     SoUnits::NANOMETERS
     SoUnits::ANGSTROMS
     SoUnits::KILOMETERS
     SoUnits::FEET
     SoUnits::INCHES
     SoUnits::POINTS
     SoUnits::YARDS
     SoUnits::MILES
     SoUnits::NAUTICAL_MILES
}

Fields from class SoUnits:

SoSFEnum            units

Methods from class SoUnits:

                     SoUnits()
static SoType       getClassTypeId()

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

the way that's a LOT of inherited methods and not a single one of them is getting skipped, periodt. πŸ’…


🌈 DESCRIPTION 🌈

so what does this node actually DO? it defines a uniform 3D scale about the origin, relative to whatever units were defined before it. 🎯

the default units for all data are meters. write that down. πŸ–ŠοΈ

here's the iconic part: adding a SoUnits node with the value INCHES has the exact same effect as adding an SoScale node with the scaleFactor of (.0254, .0254, .0254). same vibe, different font. ✨

and it's cumulative, bestie β€” any subsequent SoUnits node takes the previous units into account. so the chain keeps building on itself, like a group chat where everyone's replying to the last person. πŸ“²

when you're building a composite object out of a bunch of pieces, it would be a good practice to add an SoUnits node at the beginning of each of the pieces, under an SoSeparator node, so you can make sure all the pieces fit together with the same scale. do this and your model will not look like a cursed collage. πŸ™ˆ


πŸ’… FIELDS πŸ’…

  • SoSFEnum units β€” defines the current unit. that's it. that's the whole field. one job, and she does it flawlessly. πŸ‘‘

🫢 METHODS 🫢

  • SoUnits() β€” creates a unit conversion node with default settings. a fresh baby node, defaults and all. 🍼
  • static SoType getClassTypeId() β€” returns the type identifier for this class. iykyk. πŸ”

πŸ”₯ ACTION BEHAVIOR πŸ”₯

SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPickAction

accumulates the scale β€” which is the ratio of the size from the previous unit to the current unit β€” into the current transformation. so it's doing the math for you and sliding it right into the transform. no notes. πŸ’―

SoGetMatrixAction

returns the matrix corresponding to the units scaling. just hands you the matrix. straightforward, generous, main character energy. 🎁


⭐ FILE FORMAT/DEFAULTS ⭐

Units {
     units  METERS
}

look at her. minimal. default. flawless. πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

SoScale, SoTransform


okay that's the whole page, you ate it, you understood it, you're basically a units expert now πŸ§šπŸ’œ β€” and before you go, the footer of this manual says SoUnits(3IV)() which is literally the same as the title up top, because this manpage believes in symmetry and also in not giving us a version number or a date. iconic behaviour honestly. mwah. πŸ’–βœ¨πŸŒΈ