SOCYLINDER(3iv)

πŸ’– SoCylinder(3IV) β€” cylinder shape node ✨

okay bestie, welcome to the SoCylinder(3IV) manual page, aka the glow-up doc for everyone's fave little 3D tube. she's round, she's capped, she's literally the moment. let's get into it 🫢


πŸŽ€ NAME

SoCylinder β€” cylinder shape node. no cap, that's the whole thing.


🌸 INHERITS FROM

SoBase > SoFieldContainer > SoNode > SoShape > SoCylinder

the whole ancestry tree walked so she could run πŸ’…


✨ SYNOPSIS

first things first, include her:

#include <Inventor/nodes/SoCylinder.h>

then there's the part enum, which is basically the "which bits of me are visible" dropdown:

enum Part {
     SoCylinder::SIDES   The cylindrical part
     SoCylinder::TOP     The top circular face
     SoCylinder::BOTTOM  The bottom circular face
     SoCylinder::ALL     All parts
}

🌈 Fields from class SoCylinder

SoSFBitMask         parts
SoSFFloat           radius
SoSFFloat           height

πŸ¦‹ Methods from class SoCylinder

                     SoCylinder()
void                addPart(SoCylinder::Part part)
void                removePart(SoCylinder::Part part)
SbBool              hasPart(SoCylinder::Part part) const
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

πŸ’– DESCRIPTION

so this node is a simple capped cylinder, and she is centered around the y-axis. by default she's sitting at (0,0,0) and her default size is -1 to +1 in all three dimensions. wanna make her a different size? that's literally what the radius and height fields are for, bestie.

she gets transformed by the current cumulative transformation, and she's drawn with whatever the current lighting model, drawing style, material, and geometric complexity are. she's adaptable like that πŸ’…

here's the material tea 🍡 β€” if the current material binding is PER_PART or PER_PART_INDEXED, then:

  • the first current material is used for the sides of the cylinder
  • the second is used for the top
  • the third is used for the bottom</bottom>

otherwise? the first material is used for the entire cylinder. one look, one vibe.

now texture time πŸŽ€ β€” when a texture is applied to a cylinder, it's applied differently to the sides, top, and bottom:

  • On the sides: the texture wraps counterclockwise (from above) starting at the back of the cylinder. the texture has a vertical seam at the back, intersecting the yz-plane.
  • On the top and bottom: a circle is cut out of the texture square and applied to the top or bottom circle. the top texture appears right side up when the top of the cylinder is tilted toward the camera, and the bottom texture appears right side up when the top of the cylinder is tilted away from the camera.

(the way texture mapping really said "different for every face" 😭 iconic behavior)


🌸 FIELDS

  • SoSFBitMask parts β€” the visible parts of the cylinder. pick your faves, hide the rest πŸ’…
  • SoSFFloat radius
  • SoSFFloat height

these two define the cylinder's height and radius. and listen β€” values must be greater than 0.0. that's not a suggestion, that's the law. periodt.


✨ METHODS

  • SoCylinder() β€” creates a cylinder node with default settings. baby's first cylinder, freshly hatched 🐣
  • void addPart(SoCylinder::Part part)
  • void removePart(SoCylinder::Part part)

these are the convenience functions that make it easy to turn on or off a part of the cylinder. lowkey the most user-friendly glow-up toggles ever.

  • SbBool hasPart(SoCylinder::Part part) const β€” this convenience function returns whether a given part is on or off. she's checking in on you 🫢
  • static SoType getClassTypeId() β€” returns the type identifier for this class.

πŸ¦‹ ACTION BEHAVIOR

  • SoGLRenderAction β€” draws the cylinder based on the current coordinates, materials, drawing style, and so on. (and so on is doing a lot of heavy lifting there but we respect it)
  • SoRayPickAction β€” intersects the ray with the cylinder. the part of the cylinder that was picked is available from the SoCylinderDetail. main character gets picked, obviously.
  • SoGetBoundingBoxAction β€” computes the bounding box that encloses the cylinder. personal space bubble: calculated βœ…
  • SoCallbackAction β€” if any triangle callbacks are registered with the action, they will be invoked for each successive triangle that approximates the cylinder. so many little triangles, all of them working together πŸ’€βœ¨

πŸ’œ FILE FORMAT/DEFAULTS

Cylinder {
     parts   ALL
     radius  1
     height  2
}

defaults that simply work. slay.


🌈 SEE ALSO

SoCone, SoCube, SoCylinderDetail, SoSphere

(the whole 3D solids squad 🫢)


and that's the page, bestie πŸ’– this was SoCylinder(3IV), straight from the SoCylinder(3IV)() manual β€” no version number, no date, just pure cylinder energy, forever and always. go forth and render something round πŸ‘‘πŸŒΈβœ¨