VTK
vtkPiecewiseFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPiecewiseFunction.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
42 #ifndef __vtkPiecewiseFunction_h
43 #define __vtkPiecewiseFunction_h
44 
45 #include "vtkDataObject.h"
46 
47 class vtkPiecewiseFunctionInternals;
48 
50 {
51 public:
52  static vtkPiecewiseFunction *New();
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
56  void DeepCopy( vtkDataObject *f );
57  void ShallowCopy( vtkDataObject *f );
58 
61 
63  int GetSize();
64 
66 
69  int AddPoint( double x, double y );
70  int AddPoint( double x, double y, double midpoint, double sharpness );
71  int RemovePoint( double x );
73 
75  void RemoveAllPoints();
76 
81  void AddSegment( double x1, double y1, double x2, double y2 );
82 
85  double GetValue( double x );
86 
88 
90  int GetNodeValue( int index, double val[4] );
91  int SetNodeValue( int index, double val[4] );
93 
95 
100  double *GetDataPointer();
101  void FillFromDataPointer(int, double*);
103 
105 
106  vtkGetVector2Macro( Range, double );
108 
111  int AdjustRange(double range[2]);
112 
114 
116  void GetTable( double x1, double x2, int size, float *table, int stride=1 );
117  void GetTable( double x1, double x2, int size, double *table, int stride=1 );
119 
121 
125  void BuildFunctionFromTable( double x1, double x2, int size,
126  double *table, int stride=1 );
128 
130 
136  vtkSetMacro( Clamping, int );
137  vtkGetMacro( Clamping, int );
138  vtkBooleanMacro( Clamping, int );
140 
146  const char *GetType();
147 
150  double GetFirstNonZeroValue();
151 
155  void Initialize();
156 
157  //BTX
159 
160  static vtkPiecewiseFunction* GetData(vtkInformation* info);
161  static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
162  //ETX
164 
166 
168  vtkSetMacro(AllowDuplicateScalars, int);
169  vtkGetMacro(AllowDuplicateScalars, int);
170  vtkBooleanMacro(AllowDuplicateScalars, int);
172 
173 protected:
176 
177  // The internal STL structures
178  vtkPiecewiseFunctionInternals *Internal;
179 
180  // Determines the function value outside of defined points
181  // Zero = always return 0.0 outside of defined points
182  // One = clamp to the lowest value below defined points and
183  // highest value above defined points
184  int Clamping;
185 
186  // Array of points ((X,Y) pairs)
187  double *Function;
188 
189  // Min and max range of function point locations
190  double Range[2];
191 
192  // Internal method to sort the vector and update the
193  // Range whenever a node is added or removed
194  void SortAndUpdateRange();
195 
197 
198 private:
199  vtkPiecewiseFunction(const vtkPiecewiseFunction&); // Not implemented.
200  void operator=(const vtkPiecewiseFunction&); // Not implemented.
201 };
202 
203 #endif
204 
205 
#define VTK_PIECEWISE_FUNCTION
Definition: vtkType.h:71
Defines a 1D piecewise function.
Store vtkAlgorithm input/output information.
#define VTK_FILTERING_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:37
Store zero or more vtkInformation instances.
helper class to get VTK data object types as string and instantiate them
vtkPiecewiseFunctionInternals * Internal