SbColor(3)
π NAME π
SbColor β bestie, this is the class that holds the red, green and blue components that make up a color value. Periodt.
(It lives in the Coin manual, section 3, and yes the header is literally SbColor(3) β we're just folding that in all cute up here instead of pasting it as its own line. π
)
β¨ SYNOPSIS β¨
#include <Inventor/SbColor.h>
Inherits SbVec3f. (Yes bestie, it's a glow-up of a vector. Keep reading. π¦)
π Public Member Functions π
SbColor (void)
SbColor (const SbVec3f &v)
SbColor (const float *const rgb)
SbColor (const float r, const float g, const float b)
SbColor & setHSVValue (float h, float s, float v)
SbColor & setHSVValue (const float hsv[3])
void getHSVValue (float &h, float &s, float &v) const
void getHSVValue (float hsv[3]) const
SbColor & setPackedValue (const uint32_t rgba, float &transparency)
uint32_t getPackedValue (const float transparency=0.0f) const
πΈ Public Member Functions inherited from SbVec3f πΈ
SbVec3f (void)
SbVec3f (const float v[3])
SbVec3f (float x, float y, float z)
SbVec3f (const SbVec3d &v)
SbVec3f (const SbVec3b &v)
SbVec3f (const SbVec3s &v)
SbVec3f (const SbVec3i32 &v)
SbVec3f (const SbPlane &p0, const SbPlane &p1, const SbPlane &p2)
SbVec3f & setValue (const float v[3])
SbVec3f & setValue (float x, float y, float z)
SbVec3f & setValue (const SbVec3f &barycentric, const SbVec3f &v0, const
SbVec3f &v1, const SbVec3f &v2)
SbVec3f & setValue (const SbVec3d &v)
SbVec3f & setValue (const SbVec3b &v)
SbVec3f & setValue (const SbVec3s &v)
SbVec3f & setValue (const SbVec3i32 &v)
const float * getValue (void) const
void getValue (float &x, float &y, float &z) const
float & operator[] (int i)
const float & operator[] (int i) const
SbBool equals (const SbVec3f &v, float tolerance) const
SbVec3f cross (const SbVec3f &v) const
float dot (const SbVec3f &v) const
SbVec3f getClosestAxis (void) const
float length (void) const
float sqrLength (void) const
float normalize (void)
void negate (void)
SbVec3f & operator*= (float d)
SbVec3f & operator/= (float d)
SbVec3f & operator+= (const SbVec3f &v)
SbVec3f & operator-= (const SbVec3f &v)
SbVec3f operator- (void) const
SbString toString () const
SbBool fromString (const SbString &str)
void print (FILE *fp) const
π Additional Inherited Members π
Protected Attributes inherited from SbVec3f
float vec [3]
Related Symbols inherited from SbVec3f
SbVec3f operator* (const SbVec3f &v, float d)
SbVec3f operator* (float d, const SbVec3f &v)
SbVec3f operator/ (const SbVec3f &v, float d)
SbVec3f operator+ (const SbVec3f &v1, const SbVec3f &v2)
SbVec3f operator- (const SbVec3f &v1, const SbVec3f &v2)
int operator== (const SbVec3f &v1, const SbVec3f &v2)
int operator!= (const SbVec3f &v1, const SbVec3f &v2)
π¦ Detailed Description π¦
Okay so the SbColor class contains the red, green and blue components which make up a color value. That's the whole vibe. π
It's used inside other classes in Coin, and it inherits SbVec3f β which means it reads that 3-component vector as a vector in the RGB cube, where red, green and blue correspond to x, y and z respectively. So like, x is red, y is green, z is blue. Not confusing at all, iykyk. π
On top of all that, SbColor adds a few extra methods so handling colors is convenient β you can set and get color values as 32 bit packed values or as HSV values. It's giving versatility, fr fr. β¨
See also
SbVec3f,SbColor4f
π§ Constructor & Destructor Documentation π§
SbColor::SbColor (void )
Default constructor, bestie. Heads up though: the color value will be uninitialized. So don't come for it expecting a color, because it has none. π
SbColor::SbColor (const SbVec3f & v)
Constructs and initializes an SbColor using the red, green and blue values given by the v vector. One vector in, one whole color out. Slay. π
SbColor::SbColor (const float *const rgb)
Constructs and initializes an SbColor with the red, green and blue taken from the given rgb array. Pointer goes in, color comes out. π
SbColor::SbColor (const float r, const float g, const float b)
Constructs and initializes an SbColor with the given red, green and blue values. Three floats, zero drama. π«Ά
π Member Function Documentation π
SbColor & SbColor::setHSVValue (float hue, float saturation, float value)
Sets the color as a hue, saturation, value triplet. Important detail, no cap: the hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees. Do the math first, bestie, or the hue will be giving chaos. π
See also
getHSVValue().
SbColor & SbColor::setHSVValue (const float hsv[3])
Sets the color as a hue, saturation, value triplet. Same deal as above: the hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees. β¨
See also
getHSVValue().
void SbColor::getHSVValue (float & h, float & s, float & v) const
Returns the color as a hue, saturation, value triplet. Hand it the refs, it fills them in. Iconic. π
See also
setHSVValue().
void SbColor::getHSVValue (float hsv[3]) const
Returns the color as a hue, saturation, value triplet. Array version, same energy. π
See also
setHSVValue().
SbColor & SbColor::setPackedValue (const uint32_t rgba, float & transparency)
Sets the color value as a 32 bit combined red/green/blue/alpha value. Each component is 8 bit wide (i.e. from 0x00 to 0xff), and the red value should be stored leftmost, like this: 0xRRGGBBAA. Leftmost red, remember that. π
Here's the tea: the transparency value is not stored internally in SbColor β it's just converted to a transparency value in [0, 1] and returned in the transparency field. A value of 1.0 means completely transparent and a value of 0.0 is completely opaque. So don't go looking for it later, because it is not in there. π
See also
getPackedValue().
uint32_t SbColor::getPackedValue (const float transparency = 0.0f) const
Returns the color as a 32 bit packed integer in the form 0xRRGGBBAA. The transparency part of the return value is taken from the supplied transparency argument β and yeah, it defaults to 0.0f, so if you say nothing you get full opaque energy. π«Ά
See also
setPackedValue().
β Author β
Generated automatically by Doxygen for Coin from the source code. (Not a human author, just a robot doing its little thing. Respect. π€π)
And that's the whole page, bestie!! This one is Coin version 4.0.10, dated Thu Jun 25 2026 00:00:00 β so if you were reading SbColor(3) from that snapshot, you're in exactly the right place. Go paint something gorgeous with it. πβ¨π¦π
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms