Libprimis
Imprimis' 3D destroyable world engine
Loading...
Searching...
No Matches
bvec Struct Reference

three dimensional Cartesian byte vector More...

#include <geom.h>

Public Member Functions

 bvec (uchar x, uchar y, uchar z)
 
 bvec (const vec &v)
 
 bvec (const vec4< uchar > &v)
 
uchar & operator[] (int i)
 
uchar operator[] (int i) const
 
bool operator== (const bvec &v) const
 
bool operator!= (const bvec &v) const
 
bool iszero () const
 
vec tonormal () const
 
bvecnormalize ()
 
void lerp (const bvec &a, const bvec &b, float t)
 
void lerp (const bvec &a, const bvec &b, int ka, int kb, int d)
 
void flip ()
 
void scale (int k, int d)
 
bvecshl (int n)
 
bvecshr (int n)
 
vec tocolor () const
 
int tohexcolor () const
 

Static Public Member Functions

static bvec fromcolor (const vec &v)
 
static bvec from565 (ushort c)
 
static bvec hexcolor (int color)
 

Public Attributes

union { 
 
   struct { 
 
      uchar   x 
 
      uchar   y 
 
      uchar   z 
 
   }  
 
   struct { 
 
      uchar   r 
 
      uchar   g 
 
      uchar   b 
 
   }  
 
   uchar   v [3] 
 
};  
 

Detailed Description

three dimensional Cartesian byte vector

A three dimensional position in the Cartesian space consisting of values between 0 and 255 in the x,y,z (r,g,b) axes. Generally the vector space represented by this object is the HTML color space (0x000000 to 0xFFFFFF). This object contains several utility methods and operations corresponding to useful color transformations in this space.

For general purpose integral-valued positions in Cartesian space, ivec is generally a more useful choice.


The documentation for this struct was generated from the following file: