Files Classes Functions Hierarchy
#include <graphmisc.h>
Public Member Functions | |
| template<class T > | |
| point3< T > & | operator() (point3< T > &p, T const v) const |
| Map a value to a color. | |
| template<class T > | |
| void | operator() (T &x, T &y, T &z, T const v) const |
| Map a value to a color. | |
See "Computer Visualization" by R.Gallagher, page 91.
Definition at line 910 of file graphmisc.h.
Map a value to a color.
Definition at line 1003 of file graphmisc.h.
01004 { 01005 assert(v>=0.0); 01006 assert(v<=1.0); 01007 01008 x = z = 0.0; 01009 y = 1.0; 01010 01011 if (v>=0.75) 01012 x = 1.0; 01013 else 01014 if (v>0.5) 01015 x = (v-0.5)/0.25; 01016 01017 if (v<=0.25) 01018 z = 1.0; 01019 else 01020 if (v<0.5) 01021 z = 1.0 - (v-0.25)/0.25; 01022 01023 if (v>0.75) 01024 y = 1.0 - (v-0.75)/0.25; 01025 else 01026 if (v<0.25) 01027 y = v/0.25; 01028 }
| point3< T > & colorfunction::operator() | ( | point3< T > & | p, | |
| T const | v | |||
| ) | const [inline] |
Map a value to a color.
Definition at line 973 of file graphmisc.h.
References point3< T >::x, point3< T >::y, and point3< T >::z.
00974 { 00975 assert(v>=0.0); 00976 assert(v<=1.0); 00977 00978 p.x = p.z = 0.0; 00979 p.y = 1.0; 00980 00981 if (v>=0.75) 00982 p.x = 1.0; 00983 else 00984 if (v>0.5) 00985 p.x = (v-0.5)/0.25; 00986 00987 if (v<=0.25) 00988 p.z = 1.0; 00989 else 00990 if (v<0.5) 00991 p.z = 1.0 - (v-0.25)/0.25; 00992 00993 if (v>0.75) 00994 p.y = 1.0 - (v-0.75)/0.25; 00995 else 00996 if (v<0.25) 00997 p.y = v/0.25; 00998 00999 return p; 01000 }
1.5.8