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 "vtkCommonDataModelModule.h" // For export macro
46 #include "vtkDataObject.h"
47 
48 class vtkPiecewiseFunctionInternals;
49 
51 {
52 public:
53  static vtkPiecewiseFunction *New();
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
57  void DeepCopy( vtkDataObject *f );
58  void ShallowCopy( vtkDataObject *f );
59 
62 
64  int GetSize();
65 
67 
70  int AddPoint( double x, double y );
71  int AddPoint( double x, double y, double midpoint, double sharpness );
72  int RemovePoint( double x );
74 
76  void RemoveAllPoints();
77 
82  void AddSegment( double x1, double y1, double x2, double y2 );
83 
86  double GetValue( double x );
87 
89 
92  int GetNodeValue( int index, double val[4] );
93  int SetNodeValue( int index, double val[4] );
95 
97 
102  double *GetDataPointer();
103  void FillFromDataPointer(int, double*);
105 
107 
108  vtkGetVector2Macro( Range, double );
110 
113  int AdjustRange(double range[2]);
114 
116 
118  void GetTable( double x1, double x2, int size, float *table, int stride=1 );
119  void GetTable( double x1, double x2, int size, double *table, int stride=1 );
121 
123 
127  void BuildFunctionFromTable( double x1, double x2, int size,
128  double *table, int stride=1 );
130 
132 
138  vtkSetMacro( Clamping, int );
139  vtkGetMacro( Clamping, int );
140  vtkBooleanMacro( Clamping, int );
142 
148  const char *GetType();
149 
152  double GetFirstNonZeroValue();
153 
157  void Initialize();
158 
159  //BTX
161 
164  //ETX
166 
168 
170  vtkSetMacro(AllowDuplicateScalars, int);
171  vtkGetMacro(AllowDuplicateScalars, int);
172  vtkBooleanMacro(AllowDuplicateScalars, int);
174 
175 protected:
178 
179  // The internal STL structures
180  vtkPiecewiseFunctionInternals *Internal;
181 
182  // Determines the function value outside of defined points
183  // Zero = always return 0.0 outside of defined points
184  // One = clamp to the lowest value below defined points and
185  // highest value above defined points
186  int Clamping;
187 
188  // Array of points ((X,Y) pairs)
189  double *Function;
190 
191  // Min and max range of function point locations
192  double Range[2];
193 
194  // Internal method to sort the vector and update the
195  // Range whenever a node is added, edited or removed.
196  // It always calls Modified().
197  void SortAndUpdateRange();
198  // Returns true if the range has been updated and Modified() has been called
199  bool UpdateRange();
200 
202 
203 private:
204  vtkPiecewiseFunction(const vtkPiecewiseFunction&); // Not implemented.
205  void operator=(const vtkPiecewiseFunction&); // Not implemented.
206 };
207 
208 #endif
209 
210 
static vtkDataObject * GetData(vtkInformation *info)
static vtkDataObject * New()
#define VTK_PIECEWISE_FUNCTION
Definition: vtkType.h:71
Defines a 1D piecewise function.
Store vtkAlgorithm input/output information.
virtual void Initialize()
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkPiecewiseFunctionInternals * Internal
virtual void DeepCopy(vtkDataObject *src)
#define VTKCOMMONDATAMODEL_EXPORT
virtual void ShallowCopy(vtkDataObject *src)