00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00039 #ifndef __vtkPiecewiseFunction_h
00040 #define __vtkPiecewiseFunction_h
00041
00042 #include "vtkDataObject.h"
00043
00044 class vtkPiecewiseFunctionInternals;
00045
00046 class VTK_FILTERING_EXPORT vtkPiecewiseFunction : public vtkDataObject
00047 {
00048 public:
00049 static vtkPiecewiseFunction *New();
00050 vtkTypeRevisionMacro(vtkPiecewiseFunction,vtkDataObject);
00051 void PrintSelf(ostream& os, vtkIndent indent);
00052
00053 void DeepCopy( vtkDataObject *f );
00054 void ShallowCopy( vtkDataObject *f );
00055
00057 int GetDataObjectType() {return VTK_PIECEWISE_FUNCTION;};
00058
00060 int GetSize();
00061
00063
00066 int AddPoint( double x, double y );
00067 int AddPoint( double x, double y, double midpoint, double sharpness );
00068 int RemovePoint( double x );
00070
00072 void RemoveAllPoints();
00073
00078 void AddSegment( double x1, double y1, double x2, double y2 );
00079
00082 double GetValue( double x );
00083
00085
00087 int GetNodeValue( int index, double val[4] );
00088 int SetNodeValue( int index, double val[4] );
00090
00092
00097 double *GetDataPointer();
00098 void FillFromDataPointer(int, double*);
00100
00102
00103 vtkGetVector2Macro( Range, double );
00105
00108 int AdjustRange(double range[2]);
00109
00111
00113 void GetTable( double x1, double x2, int size, float *table, int stride=1 );
00114 void GetTable( double x1, double x2, int size, double *table, int stride=1 );
00116
00118
00122 void BuildFunctionFromTable( double x1, double x2, int size,
00123 double *table, int stride=1 );
00125
00127
00133 vtkSetMacro( Clamping, int );
00134 vtkGetMacro( Clamping, int );
00135 vtkBooleanMacro( Clamping, int );
00137
00143 const char *GetType();
00144
00147 double GetFirstNonZeroValue();
00148
00152 void Initialize();
00153
00154
00156
00157 static vtkPiecewiseFunction* GetData(vtkInformation* info);
00158 static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
00159
00161
00163
00165 vtkSetMacro(AllowDuplicateScalars, int);
00166 vtkGetMacro(AllowDuplicateScalars, int);
00167 vtkBooleanMacro(AllowDuplicateScalars, int);
00169
00170 protected:
00171 vtkPiecewiseFunction();
00172 ~vtkPiecewiseFunction();
00173
00174
00175 vtkPiecewiseFunctionInternals *Internal;
00176
00177
00178
00179
00180
00181 int Clamping;
00182
00183
00184 double *Function;
00185
00186
00187 double Range[2];
00188
00189
00190
00191 void SortAndUpdateRange();
00192
00193 int AllowDuplicateScalars;
00194
00195 private:
00196 vtkPiecewiseFunction(const vtkPiecewiseFunction&);
00197 void operator=(const vtkPiecewiseFunction&);
00198 };
00199
00200 #endif
00201
00202