00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00030 #ifndef __vtkPiecewiseFunction_h
00031 #define __vtkPiecewiseFunction_h
00032
00033 #include "vtkDataObject.h"
00034
00035 class VTK_FILTERING_EXPORT vtkPiecewiseFunction : public vtkDataObject
00036 {
00037 public:
00038 static vtkPiecewiseFunction *New();
00039 vtkTypeRevisionMacro(vtkPiecewiseFunction,vtkDataObject);
00040 void PrintSelf(ostream& os, vtkIndent indent);
00041
00042 void Initialize();
00043 void DeepCopy( vtkDataObject *f );
00044 void ShallowCopy( vtkDataObject *f );
00045
00047 int GetDataObjectType() {return VTK_PIECEWISE_FUNCTION;};
00048
00050 int GetSize();
00051
00053
00056 int AddPoint( double x, double val );
00057 int RemovePoint( double x );
00059
00061 void RemoveAllPoints();
00062
00065 void AddSegment( double x1, double val1, double x2, double val2 );
00066
00070 double GetValue( double x );
00071
00073
00075 double *GetDataPointer() {return this->Function;};
00076 void FillFromDataPointer(int, double*);
00078
00080 double *GetRange();
00081
00084 int AdjustRange(double range[2]);
00085
00087
00091 void GetTable( double x1, double x2, int size, float *table, int stride=1 );
00092 void GetTable( double x1, double x2, int size, double *table, int stride=1 );
00094
00096
00101 void BuildFunctionFromTable( double x1, double x2, int size,
00102 double *table, int stride=1 );
00104
00106
00112 vtkSetMacro( Clamping, int );
00113 vtkGetMacro( Clamping, int );
00114 vtkBooleanMacro( Clamping, int );
00116
00122 const char *GetType();
00123
00126 double GetFirstNonZeroValue();
00127
00128
00130
00131 static vtkPiecewiseFunction* GetData(vtkInformation* info);
00132 static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
00133
00135
00136 protected:
00137 vtkPiecewiseFunction();
00138 ~vtkPiecewiseFunction();
00139
00140
00141 int ArraySize;
00142
00143
00144
00145
00146
00147 int Clamping;
00148
00149
00150 double *Function;
00151
00152
00153 int FunctionSize;
00154
00155
00156 double FunctionRange[2];
00157
00158
00159
00160 void IncreaseArraySize();
00161
00162
00163
00164 int InsertPoint( double x, double val );
00165
00166
00167
00168 void MovePoints( int index, int down );
00169 private:
00170 vtkPiecewiseFunction(const vtkPiecewiseFunction&);
00171 void operator=(const vtkPiecewiseFunction&);
00172 };
00173
00174 #endif
00175