[vtk-developers] vtkColorTransferFunction ambiguities about ranges

Sean McBride sean at rogue-research.com
Thu Apr 25 11:58:29 EDT 2013


On Wed, 24 Apr 2013 15:04:57 -0400, David Doria said:

>>   // Description:
>>   // Add/Remove a point to/from the function defined in RGB or HSV
>>   // Return the index of the point (0 based), or -1 on error.
>>   // See the description of class vtkPiecewiseFunction for an explanation of
>>   // midpoint and sharpness.
>>   int AddRGBPoint( double x, double r, double g, double b );
>>   int AddRGBPoint( double x, double r, double g, double b,
>>                    double midpoint, double sharpness );
>>   int AddHSVPoint( double x, double h, double s, double v );
>>   int AddHSVPoint( double x, double h, double s, double v,
>>                    double midpoint, double sharpness );
>>
>> What is the allowable/required/expected range of these things?  Should
>RGB values always be 0 to 1?  Likewise for HSV?  Is hue 0 to 1?  0 to
>2π?  0 to 360?  etc.  Am I just missing where this is documented?
>>
>> Cheers,
>
>I'm not sure if vtkColorTransferFunction is consistent, but I added
>the ranges for color space conversions to the vtkMath documentation a
>while back, e.g.

Well, anyone have an opinion on

Common/DataModel/Testing/Cxx/otherColorTransferFunction.cxx:36

  ctf1->AddHSVSegment (11.0, 1, 1, 6, 15.0, .1, .2, .3);

where the API is:

  void AddHSVSegment( double x1, double h1, double s1, double v1,
                      double x2, double h2, double s2, double v2 );

Is "6" a valid value to pass as 'V' in HSV?

It's the cause of the undefined cast of a large double to a uint8.  If I change the test's "6" to "0.6" the test still passes and the undefined behaviour is gone.

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada


More information about the vtk-developers mailing list