Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Filtering/vtkPiecewiseFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPiecewiseFunction.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 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 00083 00087 void GetTable( double x1, double x2, int size, float *table, int stride=1 ); 00088 void GetTable( double x1, double x2, int size, double *table, int stride=1 ); 00090 00092 00097 void BuildFunctionFromTable( double x1, double x2, int size, 00098 double *table, int stride=1 ); 00100 00102 00108 vtkSetMacro( Clamping, int ); 00109 vtkGetMacro( Clamping, int ); 00110 vtkBooleanMacro( Clamping, int ); 00112 00118 const char *GetType(); 00119 00122 unsigned long GetMTime(); 00123 00126 double GetFirstNonZeroValue(); 00127 00128 protected: 00129 vtkPiecewiseFunction(); 00130 ~vtkPiecewiseFunction(); 00131 00132 // Size of the array used to store function points 00133 int ArraySize; 00134 00135 // Determines the function value outside of defined points 00136 // Zero = always return 0.0 outside of defined points 00137 // One = clamp to the lowest value below defined points and 00138 // highest value above defined points 00139 int Clamping; 00140 00141 // Array of points ((X,Y) pairs) 00142 double *Function; 00143 00144 // Number of points used to specify function 00145 int FunctionSize; 00146 00147 // Min and max range of function point locations 00148 double FunctionRange[2]; 00149 00150 // Increases size of the function array. The array grows by a factor of 2 00151 // when the array limit has been reached. 00152 void IncreaseArraySize(); 00153 00154 // Private function to add a point to the function. Returns the array 00155 // index of the inserted point. 00156 int InsertPoint( double x, double val ); 00157 00158 // Move points one index down or up in the array. This is useful for 00159 // inserting and deleting points into the array. 00160 void MovePoints( int index, int down ); 00161 private: 00162 vtkPiecewiseFunction(const vtkPiecewiseFunction&); // Not implemented. 00163 void operator=(const vtkPiecewiseFunction&); // Not implemented. 00164 }; 00165 00166 #endif 00167