Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
G3D::Color3 Class Reference

Do not subclass– this implementation makes assumptions about the memory layout. More...

Public Member Functions

 Color3 ()
 Initializes to all zero.
 
 Color3 (const Any &any)
 
 Color3 (class BinaryInput &bi)
 
 Color3 (float r, float g, float b)
 
 Color3 (float v)
 Initializes all channels to v.
 
 Color3 (const class Vector3 &v)
 
 Color3 (const float value[3])
 
 Color3 (const Color3 &other)
 Initialize from another color.
 
 Color3 (const class Color3unorm8 &other)
 
float average () const
 
Color3 bgr () const
 
Color3 cross (const Color3 &rkVector) const
 
void deserialize (class BinaryInput &bi)
 
Color3 direction () const
 
float dot (const Color3 &rkVector) const
 
bool fuzzyEq (const Color3 &other) const
 
bool fuzzyNe (const Color3 &other) const
 
size_t hashCode () const
 
bool isFinite () const
 
bool isOne () const
 
bool isZero () const
 
float length () const
 
Color3 lerp (const Color3 &other, float a) const
 
Color3 max (const Color3 &other) const
 
float max () const
 Largest element.
 
Color3 min (const Color3 &other) const
 
float min () const
 Smallest element.
 
bool nonZero () const
 
bool operator!= (const Color3 &rkVector) const
 
Color3 operator* (float s) const
 
Color3 operator* (const Color3 &rkVector) const
 
Color3operator*= (const Color3 &rkVector)
 
Color3operator*= (float fScalar)
 
Color3 operator+ (const Color3 &rkVector) const
 
Color3operator+= (const Color3 &rkVector)
 
Color3 operator- (const Color3 &rkVector) const
 
Color3 operator- () const
 
Color3operator-= (const Color3 &rkVector)
 
Color3 operator/ (float fScalar) const
 
Color3operator/= (float fScalar)
 
Color3operator= (const Any &a)
 
Color3operator= (const Color3 &rkVector)
 
bool operator== (const Color3 &rkVector) const
 
const float & operator[] (int i) const
 
float & operator[] (int i)
 
Color3 pow (const Color3 &other) const
 
Color3 pow (float other) const
 
const Color3rgb () const
 Returns this color.
 
void serialize (class BinaryOutput &bo) const
 
float squaredLength () const
 
float sum () const
 
Any toAny () const
 Converts the Color3 to an Any.
 
std::string toString () const
 
Color3 unitCross (const Color3 &rkVector) const
 
float unitize (float fTolerance=1e-06)
 

Static Public Member Functions

static Color3 ansiMap (uint32 i)
 Generate colors according to the ANSI color set, mod 16.
 
static const Color3black ()
 
static const Color3blue ()
 
static const Color3brown ()
 
static const Color3cyan ()
 
static Color3 fromARGB (uint32)
 Initialize from an HTML-style color (e.g.
 
static Color3 fromHSV (const Vector3 &_hsv)
 Converts from HSV to RGB , note: toHSV(fromHSV(_hsv)) may not be _hsv, if it is at a grey point or black point.
 
static const Color3gray ()
 
static const Color3green ()
 
static Color3 jetColorMap (const float &val)
 Duplicates the matlab jet colormap maps [0,1] –> (r,g,b) where blue is close to 0 and red is close to 1.
 
static const Color3one ()
 
static const Color3orange ()
 
static Color3 pastelMap (uint32 i)
 Generate colors using a hash such that adjacent values are unlikely to have similar colors.
 
static const Color3purple ()
 
static Color3 rainbowColorMap (float hue)
 Returns colors with maximum saturation and value.
 
static Color3 random ()
 Random unit vector.
 
static const Color3red ()
 
static Vector3 toHSV (const Color3 &_rgb)
 
static const Color3wheelRandom ()
 Returns one of the color wheel colors (e.g.
 
static const Color3white ()
 
static const Color3yellow ()
 
static const Color3zero ()
 

Public Attributes

float b
 
float g
 
float r
 Channel value.
 

Detailed Description

Do not subclass– this implementation makes assumptions about the memory layout.

Constructor & Destructor Documentation

G3D::Color3::Color3 ( )
inline

Initializes to all zero.

Referenced by bgr(), cross(), max(), min(), operator*(), operator+(), operator-(), and pow().

G3D::Color3::Color3 ( const Any any)
explicit
Parameters
anyMust be in one of the following forms:

In the current implementation, G3D::Power3, G3D::Radiance3, and G3D::Irradiance3 are typedefs for Color3, so Color3 accepts "Power3" and "Radiance3" as a prefixes as well, e.g., Power3(1,0,0).

G3D::Color3::Color3 ( class BinaryInput bi)
explicit
G3D::Color3::Color3 ( float  r,
float  g,
float  b 
)
inline
G3D::Color3::Color3 ( float  v)
inlineexplicit

Initializes all channels to v.

G3D::Color3::Color3 ( const class Vector3 v)
explicit
G3D::Color3::Color3 ( const float  value[3])
inlineexplicit
G3D::Color3::Color3 ( const Color3 other)
inline

Initialize from another color.

G3D::Color3::Color3 ( const class Color3unorm8 &  other)

Member Function Documentation

static Color3 G3D::Color3::ansiMap ( uint32  i)
static

Generate colors according to the ANSI color set, mod 16.

See Also
pastelMap
float G3D::Color3::average ( ) const
inline
Color3 G3D::Color3::bgr ( ) const
inline
static const Color3& G3D::Color3::black ( )
static
static const Color3& G3D::Color3::blue ( )
static
static const Color3& G3D::Color3::brown ( )
static
Color3 G3D::Color3::cross ( const Color3 rkVector) const
inline
static const Color3& G3D::Color3::cyan ( )
static
void G3D::Color3::deserialize ( class BinaryInput bi)
Color3 G3D::Color3::direction ( ) const
inline

Referenced by unitCross().

float G3D::Color3::dot ( const Color3 rkVector) const
inline
static Color3 G3D::Color3::fromARGB ( uint32  )
static

Initialize from an HTML-style color (e.g.

0xFF0000 == RED)

static Color3 G3D::Color3::fromHSV ( const Vector3 _hsv)
static

Converts from HSV to RGB , note: toHSV(fromHSV(_hsv)) may not be _hsv, if it is at a grey point or black point.

The components of _hsv should lie in the unit interval.

Referenced Code:
Alvy Ray Smith SIGGRAPH 1978 "Color Gamut Transform Pairs"
bool G3D::Color3::fuzzyEq ( const Color3 other) const
inline
bool G3D::Color3::fuzzyNe ( const Color3 other) const
inline
static const Color3& G3D::Color3::gray ( )
static
static const Color3& G3D::Color3::green ( )
static
size_t G3D::Color3::hashCode ( ) const
bool G3D::Color3::isFinite ( ) const
bool G3D::Color3::isOne ( ) const
inline
bool G3D::Color3::isZero ( ) const
inline
static Color3 G3D::Color3::jetColorMap ( const float &  val)
static

Duplicates the matlab jet colormap maps [0,1] –> (r,g,b) where blue is close to 0 and red is close to 1.

float G3D::Color3::length ( ) const
inline
Color3 G3D::Color3::lerp ( const Color3 other,
float  a 
) const
inline

Referenced by G3D::lerp().

Color3 G3D::Color3::max ( const Color3 other) const
inline

Referenced by G3D::max().

float G3D::Color3::max ( ) const
inline

Largest element.

Color3 G3D::Color3::min ( const Color3 other) const
inline

Referenced by G3D::min().

float G3D::Color3::min ( ) const
inline

Smallest element.

bool G3D::Color3::nonZero ( ) const
inline
static const Color3& G3D::Color3::one ( )
static
bool G3D::Color3::operator!= ( const Color3 rkVector) const
inline
Color3 G3D::Color3::operator* ( float  s) const
inline
Color3 G3D::Color3::operator* ( const Color3 rkVector) const
inline
Color3 & G3D::Color3::operator*= ( const Color3 rkVector)
inline
Color3 & G3D::Color3::operator*= ( float  fScalar)
inline
Color3 G3D::Color3::operator+ ( const Color3 rkVector) const
inline
Color3 & G3D::Color3::operator+= ( const Color3 rkVector)
inline
Color3 G3D::Color3::operator- ( const Color3 rkVector) const
inline
Color3 G3D::Color3::operator- ( ) const
inline
Color3 & G3D::Color3::operator-= ( const Color3 rkVector)
inline
Color3 G3D::Color3::operator/ ( float  fScalar) const
inline
Color3& G3D::Color3::operator/= ( float  fScalar)
Color3& G3D::Color3::operator= ( const Any a)
Color3 & G3D::Color3::operator= ( const Color3 rkVector)
inline
bool G3D::Color3::operator== ( const Color3 rkVector) const
inline
const float & G3D::Color3::operator[] ( int  i) const
inline
float & G3D::Color3::operator[] ( int  i)
inline
static const Color3& G3D::Color3::orange ( )
static
static Color3 G3D::Color3::pastelMap ( uint32  i)
static

Generate colors using a hash such that adjacent values are unlikely to have similar colors.

Useful for rendering with stable but arbitrary colors, e.g., when debugging a mesh algorithm.

See Also
ansiMap
Color3 G3D::Color3::pow ( const Color3 other) const
inline

Referenced by pow().

Color3 G3D::Color3::pow ( float  other) const
inline
static const Color3& G3D::Color3::purple ( )
static
static Color3 G3D::Color3::rainbowColorMap ( float  hue)
static

Returns colors with maximum saturation and value.

Parameters
hue[0, 1]
static Color3 G3D::Color3::random ( )
static

Random unit vector.

static const Color3& G3D::Color3::red ( )
static
const Color3& G3D::Color3::rgb ( ) const
inline

Returns this color.

void G3D::Color3::serialize ( class BinaryOutput bo) const
float G3D::Color3::squaredLength ( ) const
inline

Referenced by fuzzyEq(), and fuzzyNe().

float G3D::Color3::sum ( ) const
inline

Referenced by average().

Any G3D::Color3::toAny ( ) const

Converts the Color3 to an Any.

static Vector3 G3D::Color3::toHSV ( const Color3 _rgb)
static
std::string G3D::Color3::toString ( ) const
Color3 G3D::Color3::unitCross ( const Color3 rkVector) const
inline
float G3D::Color3::unitize ( float  fTolerance = 1e-06)
static const Color3& G3D::Color3::wheelRandom ( )
static

Returns one of the color wheel colors (e.g.

RED, GREEN, CYAN). Does not include white, black, or gray.

static const Color3& G3D::Color3::white ( )
static
static const Color3& G3D::Color3::yellow ( )
static
static const Color3& G3D::Color3::zero ( )
static

Member Data Documentation

float G3D::Color3::b
float G3D::Color3::g
float G3D::Color3::r

documentation generated on Sat Jan 12 2013 22:49:54 using doxygen 1.8.2