16 using namespace hippodraw;
44 double r = 1;
double g = 1;
double b = 1;
53 if ( brk_pt <= (1 - brk_pt))
54 flat = flat * ( brk_pt);
55 else flat = flat * ( 1 - brk_pt);
61 if ( v < (
m_vmin + ( 1.25 * brk_pt - 0.5 * flat + col) *
m_dv ) )
64 else if ( v > (
m_vmin + ( 1.25 * brk_pt - 0.5 * flat + col) *
m_dv ) &&
65 v < (
m_vmin + ( 1.25 * brk_pt + 0.5 * flat + col) *
m_dv ) )
66 r = ( v -
m_vmin - ( 1.25 * brk_pt - 0.5 * flat + col) * m_dv ) /
67 ( ( (flat+0.001) ) * m_dv );
69 else if( v > (
m_vmin + ( 1.25 * brk_pt + 0.5 * flat + col) *
m_dv ) &&
73 else r = 1 - 4 * ( v -
m_vmin - ( 1.25 + col ) * m_dv ) /
m_dv;
77 if ( v < (
m_vmin + (brk_pt - flat + col) *
m_dv ))
80 else if ( v > (
m_vmin + (brk_pt - flat + col) *
m_dv ) &&
81 v < (
m_vmin + (brk_pt + flat + col) *
m_dv ) )
84 else if ( v > (
m_vmin + (brk_pt + flat + col) *
m_dv ) &&
87 g = 1 - ( v -
m_vmin - ( brk_pt + flat + col )*m_dv)/
88 ( (1.001 - brk_pt - flat ) * m_dv );
94 if ( v < (
m_vmin + ( 0.75 * brk_pt - 0.5 * flat + col ) *
m_dv ) )
97 else if ( v > (
m_vmin + ( 0.75 * brk_pt - 0.5 * flat + col ) *
m_dv ) &&
98 v < (
m_vmin + ( 0.75 * brk_pt + 0.5 * flat + col) *
m_dv ) )
100 b = 1 - ( v -
m_vmin - ( 0.75 * brk_pt - 0.5 * flat + col )*m_dv ) /
101 ( ( (flat + 0.001) ) * m_dv );
103 else if ( v > (
m_vmin + ( 0.75 * brk_pt + 0.5 * flat + col) *
m_dv ) &&
107 else if ( v > (
m_vmin + ( 1 + col ) *
m_dv ) &&
110 b = 4 * ( v -
m_vmin - ( 1 + col ) * m_dv ) /
m_dv ;
114 int red = static_cast <
int > ( r * 255. );
115 int green = static_cast <
int > ( g * 255. );
116 int blue = static_cast <
int > ( b * 255. );
119 assert ( red < 256 && green < 256 && blue < 256 );
120 color.
setColor ( red, green, blue );
double m_dv
The distance of the expected values, i.e.
void setColor(const std::string &)
Sets the color.
virtual bool hasControlPoints() const
Returns true.
double m_vmin
The minimum value expected.
virtual void doubleToColor(double value, Color &color) const
BinToUsrDefinedScale(const char *name)
The constructor.
std::vector< double > m_control_points
A set of control points that might be used for the value to color transform.
The base class for the value to the color transformation.
BinToUsrDefinedScale class interface.
virtual bool isUserDefined() const
Returns true.
virtual BinToColor * clone() const
Creates a copy of itself.
A Color class for creating the color object following the standard RGB color space.
The class derived from the BinToColor class.