Commit cb26a6c7 authored by Ken Martin's avatar Ken Martin

another helping of doubles

parent 57a099ea
......@@ -31,7 +31,7 @@ void TestOLT(vtkLookupTable *lut1)
lut1->SetRampToLinear();
lut1->Build();
float rgb[4];
double rgb[4];
lut1->GetColor(0, rgb);
lut1->GetColor(0);
......@@ -43,71 +43,114 @@ void TestOLT(vtkLookupTable *lut1)
unsigned char output[4*1024];
int bitA = 1;
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_BIT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_BIT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE);
char charA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE);
unsigned char ucharA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_LUMINANCE);
int intA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
2, 1, VTK_LUMINANCE);
unsigned int uintA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_LUMINANCE);
long longA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
2, 1, VTK_LUMINANCE);
unsigned long ulongA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_LUMINANCE);
short shortA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
2, 1, VTK_LUMINANCE);
unsigned short ushortA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ushortA, output, VTK_UNSIGNED_SHORT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ushortA, output, VTK_UNSIGNED_SHORT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ushortA, output, VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ushortA, output, VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE);
float floatA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) floatA, output, VTK_FLOAT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) floatA, output, VTK_FLOAT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) floatA, output, VTK_FLOAT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) floatA, output, VTK_FLOAT, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) floatA, output,
VTK_FLOAT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) floatA, output,
VTK_FLOAT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) floatA, output,
VTK_FLOAT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) floatA, output,
VTK_FLOAT, 2, 1, VTK_LUMINANCE);
double doubleA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) doubleA, output, VTK_DOUBLE, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) doubleA, output, VTK_DOUBLE, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) doubleA, output, VTK_DOUBLE, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) doubleA, output, VTK_DOUBLE, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
VTK_DOUBLE, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
VTK_DOUBLE, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
VTK_DOUBLE, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
VTK_DOUBLE, 2, 1, VTK_LUMINANCE);
}
......
This diff is collapsed.
......@@ -92,52 +92,52 @@ public:
// values less than minimum range value are clamped to minimum range value.
// Scalar values greater than maximum range value are clamped to maximum
// range value.
void SetTableRange(float r[2]);
virtual void SetTableRange(float min, float max);
vtkGetVectorMacro(TableRange,float,2);
void SetTableRange(double r[2]);
virtual void SetTableRange(double min, double max);
vtkGetVectorMacro(TableRange,double,2);
// Description:
// Set the range in hue (using automatic generation). Hue ranges
// between [0,1].
vtkSetVector2Macro(HueRange,float);
vtkGetVector2Macro(HueRange,float);
vtkSetVector2Macro(HueRange,double);
vtkGetVector2Macro(HueRange,double);
// Description:
// Set the range in saturation (using automatic generation). Saturation
// ranges between [0,1].
vtkSetVector2Macro(SaturationRange,float);
vtkGetVector2Macro(SaturationRange,float);
vtkSetVector2Macro(SaturationRange,double);
vtkGetVector2Macro(SaturationRange,double);
// Description:
// Set the range in value (using automatic generation). Value ranges
// between [0,1].
vtkSetVector2Macro(ValueRange,float);
vtkGetVector2Macro(ValueRange,float);
vtkSetVector2Macro(ValueRange,double);
vtkGetVector2Macro(ValueRange,double);
// Description:
// Set the range in alpha (using automatic generation). Alpha ranges from
// [0,1].
vtkSetVector2Macro(AlphaRange,float);
vtkGetVector2Macro(AlphaRange,float);
vtkSetVector2Macro(AlphaRange,double);
vtkGetVector2Macro(AlphaRange,double);
// Description:
// Map one value through the lookup table.
unsigned char *MapValue(float v);
unsigned char *MapValue(double v);
// Description:
// Map one value through the lookup table and return the color as
// an RGB array of floats between 0 and 1.
float *GetColor(float x) { return vtkScalarsToColors::GetColor(x); }
void GetColor(float x, float rgb[3]);
// an RGB array of doubles between 0 and 1.
double *GetColor(double x) { return vtkScalarsToColors::GetColor(x); }
void GetColor(double x, double rgb[3]);
// Description:
// Map one value through the lookup table and return the alpha value
// (the opacity) as a float between 0 and 1.
float GetOpacity(float v);
// (the opacity) as a double between 0 and 1.
double GetOpacity(double v);
// Description:
// Return the table index associated with a particular value.
virtual vtkIdType GetIndex(float v);
virtual vtkIdType GetIndex(double v);
// Description:
// Specify the number of values (i.e., colors) in the lookup
......@@ -146,26 +146,26 @@ public:
vtkIdType GetNumberOfTableValues() { return this->NumberOfColors; };
// Description:
// Directly load color into lookup table. Use [0,1] float values for color
// Directly load color into lookup table. Use [0,1] double values for color
// component specification. Make sure that you've either used the
// Build() method or used SetNumberOfTableValues() prior to using this
// method.
void SetTableValue(vtkIdType indx, float rgba[4]);
void SetTableValue(vtkIdType indx, double rgba[4]);
// Description:
// Directly load color into lookup table. Use [0,1] float values for color
// Directly load color into lookup table. Use [0,1] double values for color
// component specification.
void SetTableValue(vtkIdType indx, float r, float g, float b, float a=1.0);
void SetTableValue(vtkIdType indx, double r, double g, double b, double a=1.0);
// Description:
// Return a rgba color value for the given index into the lookup table. Color
// components are expressed as [0,1] float values.
float *GetTableValue(vtkIdType id);
// components are expressed as [0,1] double values.
double *GetTableValue(vtkIdType id);
// Description:
// Return a rgba color value for the given index into the lookup table. Color
// components are expressed as [0,1] float values.
void GetTableValue(vtkIdType id, float rgba[4]);
// components are expressed as [0,1] double values.
void GetTableValue(vtkIdType id, double rgba[4]);
// Description:
// Get pointer to color table data. Format is array of unsigned char
......@@ -182,9 +182,9 @@ public:
// Description:
// Sets/Gets the range of scalars which will be mapped. This is a duplicate
// of Get/SetTableRange.
float *GetRange() { return this->GetTableRange(); };
void SetRange(float min, float max) { this->SetTableRange(min, max); };
void SetRange(float rng[2]) { this->SetRange(rng[0], rng[1]); };
double *GetRange() { return this->GetTableRange(); };
void SetRange(double min, double max) { this->SetTableRange(min, max); };
void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
// Description:
// Set the number of colors in the lookup table. Use
......@@ -210,16 +210,16 @@ protected:
vtkIdType NumberOfColors;
vtkUnsignedCharArray *Table;
float TableRange[2];
float HueRange[2];
float SaturationRange[2];
float ValueRange[2];
float AlphaRange[2];
double TableRange[2];
double HueRange[2];
double SaturationRange[2];
double ValueRange[2];
double AlphaRange[2];
int Scale;
int Ramp;
vtkTimeStamp InsertTime;
vtkTimeStamp BuildTime;
float RGBA[4]; //used during conversion process
double RGBA[4]; //used during conversion process
private:
vtkLookupTable(const vtkLookupTable&); // Not implemented.
......
......@@ -15,7 +15,7 @@
#include "vtkMath.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkMath, "1.81");
vtkCxxRevisionMacro(vtkMath, "1.82");
vtkStandardNewMacro(vtkMath);
long vtkMath::Seed = 1177; // One authors home address
......@@ -2051,13 +2051,24 @@ void vtkMath::SingularValueDecomposition3x3(const double A[3][3],
}
//----------------------------------------------------------------------------
void vtkMath::RGBToHSV(float r, float g, float b, float *h, float *s, float *v)
void vtkMath::RGBToHSV(float r, float g, float b,
float *h, float *s, float *v)
{
float onethird = 1.0 / 3.0;
float onesixth = 1.0 / 6.0;
float twothird = 2.0 / 3.0;
double dh,ds,dv;
vtkMath::RGBToHSV(r,g,b,&dh,&ds,&dv);
*h = static_cast<float>(dh);
*s = static_cast<float>(ds);
*v = static_cast<float>(dv);
}
void vtkMath::RGBToHSV(double r, double g, double b,
double *h, double *s, double *v)
{
double onethird = 1.0 / 3.0;
double onesixth = 1.0 / 6.0;
double twothird = 2.0 / 3.0;
float cmax, cmin;
double cmax, cmin;
cmax = r;
cmin = r;
......@@ -2113,12 +2124,23 @@ void vtkMath::RGBToHSV(float r, float g, float b, float *h, float *s, float *v)
}
//----------------------------------------------------------------------------
void vtkMath::HSVToRGB(float h, float s, float v, float *r, float *g, float *b)
void vtkMath::HSVToRGB(float h, float s, float v,
float *r, float *g, float *b)
{
double dr,dg,db;
vtkMath::HSVToRGB(h,s,v,&dr,&dg,&db);
*r = static_cast<float>(dr);
*g = static_cast<float>(dg);
*b = static_cast<float>(db);
}
void vtkMath::HSVToRGB(double h, double s, double v,
double *r, double *g, double *b)
{
float onethird = 1.0 / 3.0;
float onesixth = 1.0 / 6.0;
float twothird = 2.0 / 3.0;
float fivesixth = 5.0 / 6.0;
double onethird = 1.0 / 3.0;
double onesixth = 1.0 / 6.0;
double twothird = 2.0 / 3.0;
double fivesixth = 5.0 / 6.0;
// compute RGB from HSV
if (h > onesixth && h <= onethird) // green/red
......
......@@ -434,7 +434,14 @@ public:
{
RGBToHSV(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
}
static void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
static void RGBToHSV(float r, float g, float b,
float *h, float *s, float *v);
static void RGBToHSV(double rgb[3], double hsv[3])
{
RGBToHSV(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
}
static void RGBToHSV(double r, double g, double b,
double *h, double *s, double *v);
// Description:
// Convert color in HSV format (Hue, Saturation, Value) to RGB
......@@ -443,7 +450,14 @@ public:
{
HSVToRGB(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
}
static void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
static void HSVToRGB(float h, float s, float v,
float *r, float *g, float *b);
static void HSVToRGB(double hsv[3], double rgb[3])
{
HSVToRGB(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
}
static void HSVToRGB(double h, double s, double v,
double *r, double *g, double *b);
protected:
vtkMath() {};
......
......@@ -18,7 +18,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkScalarsToColors, "1.21");
vtkCxxRevisionMacro(vtkScalarsToColors, "1.22");
vtkScalarsToColors::vtkScalarsToColors()
{
......@@ -39,7 +39,7 @@ void vtkScalarsToColors::SetVectorModeToMagnitude()
}
// do not use SetMacro() because we do not the table to rebuild.
void vtkScalarsToColors::SetAlpha(float alpha)
void vtkScalarsToColors::SetAlpha(double alpha)
{
this->Alpha = (alpha < 0.0 ? 0.0 : (alpha > 1.0 ? 1.0 : alpha));
}
......
......@@ -46,48 +46,48 @@ public:
// Description:
// Sets/Gets the range of scalars which will be mapped.
virtual float *GetRange() = 0;
virtual void SetRange(float min, float max) = 0;
void SetRange(float rng[2])
virtual double *GetRange() = 0;
virtual void SetRange(double min, double max) = 0;
void SetRange(double rng[2])
{this->SetRange(rng[0],rng[1]);}
// Description:
// Map one value through the lookup table and return a color defined
// as a RGBA unsigned char tuple (4 bytes).
virtual unsigned char *MapValue(float v) = 0;
virtual unsigned char *MapValue(double v) = 0;
// Description:
// Map one value through the lookup table and return the color as
// an RGB array of floats between 0 and 1.
virtual void GetColor(float v, float rgb[3]) = 0;
// an RGB array of doubles between 0 and 1.
virtual void GetColor(double v, double rgb[3]) = 0;
// Description:
// Map one value through the lookup table and return the color as
// an RGB array of floats between 0 and 1.
float *GetColor(float v)
// an RGB array of doubles between 0 and 1.
double *GetColor(double v)
{this->GetColor(v,this->RGB); return this->RGB;}
// Description:
// Map one value through the lookup table and return the alpha value
// (the opacity) as a float between 0 and 1.
virtual float GetOpacity(float vtkNotUsed(v))
// (the opacity) as a double between 0 and 1.
virtual double GetOpacity(double vtkNotUsed(v))
{return 1.0;}
// Description:
// Map one value through the lookup table and return the luminance
// 0.3*red + 0.59*green + 0.11*blue as a float between 0 and 1.
// 0.3*red + 0.59*green + 0.11*blue as a double between 0 and 1.
// Returns the luminance value for the specified scalar value.
float GetLuminance(float x)
{float rgb[3]; this->GetColor(x,rgb);
return static_cast<float>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
double GetLuminance(double x)
{double rgb[3]; this->GetColor(x,rgb);
return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
// Description:
// Specify an additional opacity (alpha) value to blend with. Values
// != 1 modify the resulting color consistent with the requested
// form of the output. This is typically used by an actor in order to
// blend its opacity.
void SetAlpha(float alpha);
vtkGetMacro(Alpha,float);
void SetAlpha(double alpha);
vtkGetMacro(Alpha,double);
// Description:
// An internal method maps a data array into a 4-component, unsigned char
......@@ -147,7 +147,7 @@ protected:
vtkScalarsToColors();
~vtkScalarsToColors() {}
float Alpha;
double Alpha;
// How to map arrays with multiple components.
int VectorMode;
......@@ -165,7 +165,7 @@ protected:
//ETX
private:
float RGB[3];
double RGB[3];
private:
vtkScalarsToColors(const vtkScalarsToColors&); // Not implemented.
void operator=(const vtkScalarsToColors&); // Not implemented.
......
......@@ -52,7 +52,7 @@ int Test(ostream& strm)
<< ctf1->GetRange()[0] << ","
<< ctf1->GetRange()[1] << endl;
float table[3][256];
double table[3][256];
ctf1->GetTable(0, 15, 256, &table[0][0]);
strm << "GetTable(0, 15, 256, &table[0][0])" << endl;
......
......@@ -17,7 +17,7 @@
#include "vtkObjectFactory.h"
#include "vtkPiecewiseFunction.h"
vtkCxxRevisionMacro(vtkCardinalSpline, "1.22");
vtkCxxRevisionMacro(vtkCardinalSpline, "1.23");
vtkStandardNewMacro(vtkCardinalSpline);
//----- This hack needed to compile using gcc3 on OSX until new stdc++.dylib
......@@ -39,12 +39,12 @@ vtkCardinalSpline::vtkCardinalSpline ()
}
// Evaluate a 1D Spline
float vtkCardinalSpline::Evaluate (float t)
double vtkCardinalSpline::Evaluate (double t)
{
int i, index;
int size = this->PiecewiseFunction->GetSize ();
float *intervals;
float *coefficients;
double *intervals;
double *coefficients;
// make sure we have at least 2 points
if (size < 2)
......@@ -101,10 +101,10 @@ float vtkCardinalSpline::Evaluate (float t)
// Compute Cardinal Splines for each dependent variable
void vtkCardinalSpline::Compute ()
{
float *ts, *xs;
float *work;
float *coefficients;
float *dependent;
double *ts, *xs;
double *work;
double *coefficients;
double *dependent;
int size;
int i;
......@@ -121,7 +121,7 @@ void vtkCardinalSpline::Compute ()
if ( !this->Closed )
{
this->Intervals = new float[size];
this->Intervals = new double[size];
ts = this->PiecewiseFunction->GetDataPointer ();
for (i = 0; i < size; i++)
{
......@@ -129,17 +129,17 @@ void vtkCardinalSpline::Compute ()
}
// allocate memory for work arrays
work = new float[size];
work = new double[size];
// allocate memory for coefficients
if (this->Coefficients)
{
delete [] this->Coefficients;
}
this->Coefficients = new float [4 * size];
this->Coefficients = new double [4 * size];
// allocate memory for dependent variables
dependent = new float [size];
dependent = new double [size];
// get start of coefficients for this dependent variable
coefficients = this->Coefficients;
......@@ -152,7 +152,7 @@ void vtkCardinalSpline::Compute ()
}
this->Fit1D (size, this->Intervals, dependent,
work, (float (*)[4])coefficients,
work, (double (*)[4])coefficients,
this->LeftConstraint, this->LeftValue,
this->RightConstraint, this->RightValue);
}
......@@ -160,7 +160,7 @@ void vtkCardinalSpline::Compute ()
else //add extra "fictitious" point to close loop
{
size = size + 1;
this->Intervals = new float[size];
this->Intervals = new double[size];
ts = this->PiecewiseFunction->GetDataPointer ();
for (i = 0; i < size-1; i++)
{
......@@ -169,17 +169,17 @@ void vtkCardinalSpline::Compute ()
this->Intervals[size-1] = this->Intervals[size-2] + 1.0;
// allocate memory for work arrays
work = new float[size];
work = new double[size];
// allocate memory for coefficients
if (this->Coefficients)
{
delete [] this->Coefficients;
}
this->Coefficients = new float [4 * size];
this->Coefficients = new double [4 * size];
// allocate memory for dependent variables
dependent = new float [size];
dependent = new double [size];
// get start of coefficients for this dependent variable
coefficients = this->Coefficients;
......@@ -193,7 +193,7 @@ void vtkCardinalSpline::Compute ()
dependent[size-1] = *xs;
this->FitClosed1D (size, this->Intervals, dependent,
work, (float (*)[4])coefficients);
work, (double (*)[4])coefficients);
}
// free the work array and dependent variable storage
......@@ -203,14 +203,14 @@ void vtkCardinalSpline::Compute ()
// Compute the coefficients for a 1D spline. The spline is open.
void vtkCardinalSpline::Fit1D (int size, float *x, float *y,
float *work, float coefficients[][4],
int leftConstraint, float leftValue,
int rightConstraint, float rightValue)
void vtkCardinalSpline::Fit1D (int size, double *x, double *y,
double *work, double coefficients[][4],
int leftConstraint, double leftValue,
int rightConstraint, double rightValue)
{
float b = 0.0;
float xlk;
float xlkp;
double b = 0.0;
double xlk;
double xlkp;
int k;
// develop constraint at leftmost point.
......@@ -342,15 +342,15 @@ void vtkCardinalSpline::Fit1D (int size, float *x, float *y,
// Compute the coefficients for a 1D spline. The spline is closed
// (i.e., the first and last point are assumed the same) and the
// spline is continous in value and derivatives.
void vtkCardinalSpline::FitClosed1D (int size, float *x, float *y,
float *work, float coefficients[][4])
void vtkCardinalSpline::FitClosed1D (int size, double *x, double *y,
double *work, double coefficients[][4])
{
float b;
float xlk;
float xlkp;
int k;
float aN, bN, cN, dN;
int N;
double b;
double xlk;
double xlkp;
int k;
double aN, bN, cN, dN;
int N;
N = size - 1;
......
......@@ -42,7 +42,7 @@ public:
// Description:
// Evaluate a 1D cardinal spline.
virtual float Evaluate (float t);
virtual double Evaluate (double t);