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 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00016 00034 #ifndef __vtkPiecewiseFunction_h 00035 #define __vtkPiecewiseFunction_h 00036 00037 #include "vtkDataObject.h" 00038 00039 class VTK_FILTERING_EXPORT vtkPiecewiseFunction : public vtkDataObject 00040 { 00041 public: 00042 static vtkPiecewiseFunction *New(); 00043 vtkTypeRevisionMacro(vtkPiecewiseFunction,vtkDataObject); 00044 void PrintSelf(ostream& os, vtkIndent indent); 00045 00046 void Initialize(); 00047 void DeepCopy( vtkDataObject *f ); 00048 void ShallowCopy( vtkDataObject *f ); 00049 00051 int GetDataObjectType() {return VTK_PIECEWISE_FUNCTION;}; 00052 00054 int GetSize(); 00055 00057 00059 void AddPoint( float x, float val ); 00060 void RemovePoint( float x ); 00062 00064 void RemoveAllPoints(); 00065 00068 void AddSegment( float x1, float val1, float x2, float val2 ); 00069 00073 float GetValue( float x ); 00074 00076 00078 float *GetDataPointer() {return this->Function;}; 00079 void FillFromDataPointer(int, float*); 00081 00083 float *GetRange(); 00084 00089 void GetTable( float x1, float x2, int size, float *table, int stride=1 ); 00090 00092 00097 void BuildFunctionFromTable( float x1, float x2, int size, 00098 float *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 float 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 float *Function; 00143 00144 // Number of points used to specify function 00145 int FunctionSize; 00146 00147 // Min and max range of function point locations 00148 float 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( float x, float 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