00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00042 #ifndef __vtkPiecewiseFunction_h
00043 #define __vtkPiecewiseFunction_h
00044
00045 #include "vtkDataObject.h"
00046
00047 class vtkPiecewiseFunctionInternals;
00048
00049 class VTK_FILTERING_EXPORT vtkPiecewiseFunction : public vtkDataObject
00050 {
00051 public:
00052 static vtkPiecewiseFunction *New();
00053 vtkTypeMacro(vtkPiecewiseFunction,vtkDataObject);
00054 void PrintSelf(ostream& os, vtkIndent indent);
00055
00056 void DeepCopy( vtkDataObject *f );
00057 void ShallowCopy( vtkDataObject *f );
00058
00060 int GetDataObjectType() {return VTK_PIECEWISE_FUNCTION;};
00061
00063 int GetSize();
00064
00066
00069 int AddPoint( double x, double y );
00070 int AddPoint( double x, double y, double midpoint, double sharpness );
00071 int RemovePoint( double x );
00073
00075 void RemoveAllPoints();
00076
00081 void AddSegment( double x1, double y1, double x2, double y2 );
00082
00085 double GetValue( double x );
00086
00088
00090 int GetNodeValue( int index, double val[4] );
00091 int SetNodeValue( int index, double val[4] );
00093
00095
00100 double *GetDataPointer();
00101 void FillFromDataPointer(int, double*);
00103
00105
00106 vtkGetVector2Macro( Range, double );
00108
00111 int AdjustRange(double range[2]);
00112
00114
00116 void GetTable( double x1, double x2, int size, float *table, int stride=1 );
00117 void GetTable( double x1, double x2, int size, double *table, int stride=1 );
00119
00121
00125 void BuildFunctionFromTable( double x1, double x2, int size,
00126 double *table, int stride=1 );
00128
00130
00136 vtkSetMacro( Clamping, int );
00137 vtkGetMacro( Clamping, int );
00138 vtkBooleanMacro( Clamping, int );
00140
00146 const char *GetType();
00147
00150 double GetFirstNonZeroValue();
00151
00155 void Initialize();
00156
00157
00159
00160 static vtkPiecewiseFunction* GetData(vtkInformation* info);
00161 static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
00162
00164
00166
00168 vtkSetMacro(AllowDuplicateScalars, int);
00169 vtkGetMacro(AllowDuplicateScalars, int);
00170 vtkBooleanMacro(AllowDuplicateScalars, int);
00172
00173 protected:
00174 vtkPiecewiseFunction();
00175 ~vtkPiecewiseFunction();
00176
00177
00178 vtkPiecewiseFunctionInternals *Internal;
00179
00180
00181
00182
00183
00184 int Clamping;
00185
00186
00187 double *Function;
00188
00189
00190 double Range[2];
00191
00192
00193
00194 void SortAndUpdateRange();
00195
00196 int AllowDuplicateScalars;
00197
00198 private:
00199 vtkPiecewiseFunction(const vtkPiecewiseFunction&);
00200 void operator=(const vtkPiecewiseFunction&);
00201 };
00202
00203 #endif
00204
00205