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

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 
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   //BTX
00130 
00131   static vtkPiecewiseFunction* GetData(vtkInformation* info);
00132   static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
00133   //ETX
00135 
00136 protected:
00137   vtkPiecewiseFunction();
00138   ~vtkPiecewiseFunction();
00139 
00140   // Size of the array used to store function points
00141   int   ArraySize;
00142 
00143   // Determines the function value outside of defined points
00144   // Zero = always return 0.0 outside of defined points
00145   // One  = clamp to the lowest value below defined points and
00146   //        highest value above defined points
00147   int   Clamping;
00148 
00149   // Array of points ((X,Y) pairs)
00150   double *Function;
00151 
00152   // Number of points used to specify function
00153   int   FunctionSize;
00154 
00155   // Min and max range of function point locations
00156   double FunctionRange[2];
00157 
00158   // Increases size of the function array. The array grows by a factor of 2
00159   // when the array limit has been reached.
00160   void IncreaseArraySize();
00161 
00162   // Private function to add a point to the function. Returns the array
00163   // index of the inserted point.
00164   int InsertPoint( double x, double val );
00165 
00166   // Move points one index down or up in the array. This is useful for 
00167   // inserting and deleting points into the array.
00168   void MovePoints( int index, int down );
00169 private:
00170   vtkPiecewiseFunction(const vtkPiecewiseFunction&);  // Not implemented.
00171   void operator=(const vtkPiecewiseFunction&);  // Not implemented.
00172 };
00173 
00174 #endif
00175 

Generated on Mon Jan 21 23:07:20 2008 for VTK by  doxygen 1.4.3-20050530