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 
43 #ifndef vtkPiecewiseFunction_h
44 #define vtkPiecewiseFunction_h
45 
46 #include "vtkCommonDataModelModule.h" // For export macro
47 #include "vtkDataObject.h"
48 
49 class vtkPiecewiseFunctionInternals;
50 
51 class VTKCOMMONDATAMODEL_EXPORT vtkPiecewiseFunction : public vtkDataObject
52 {
53 public:
54  static vtkPiecewiseFunction *New();
56  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
57 
58  void DeepCopy( vtkDataObject *f ) VTK_OVERRIDE;
59  void ShallowCopy( vtkDataObject *f ) VTK_OVERRIDE;
60 
64  int GetDataObjectType() VTK_OVERRIDE {return VTK_PIECEWISE_FUNCTION;};
65 
69  int GetSize();
70 
72 
77  int AddPoint( double x, double y );
78  int AddPoint( double x, double y, double midpoint, double sharpness );
79  int RemovePoint( double x );
81 
85  void RemoveAllPoints();
86 
93  void AddSegment( double x1, double y1, double x2, double y2 );
94 
99  double GetValue( double x );
100 
102 
108  int GetNodeValue( int index, double val[4] );
109  int SetNodeValue( int index, double val[4] );
111 
113 
120  double *GetDataPointer();
121  void FillFromDataPointer(int, double*);
123 
125 
128  vtkGetVector2Macro( Range, double );
130 
136  int AdjustRange(double range[2]);
137 
139 
143  void GetTable( double x1, double x2, int size, float *table, int stride=1 );
144  void GetTable( double x1, double x2, int size, double *table, int stride=1 );
146 
153  void BuildFunctionFromTable( double x1, double x2, int size,
154  double *table, int stride=1 );
155 
157 
165  vtkSetMacro( Clamping, int );
166  vtkGetMacro( Clamping, int );
167  vtkBooleanMacro( Clamping, int );
169 
178  const char *GetType();
179 
184  double GetFirstNonZeroValue();
185 
191  void Initialize() VTK_OVERRIDE;
192 
194 
197  static vtkPiecewiseFunction* GetData(vtkInformation* info);
198  static vtkPiecewiseFunction* GetData(vtkInformationVector* v, int i=0);
200 
202 
206  vtkSetMacro(AllowDuplicateScalars, int);
207  vtkGetMacro(AllowDuplicateScalars, int);
208  vtkBooleanMacro(AllowDuplicateScalars, int);
210 
215  int EstimateMinNumberOfSamples(double const & x1, double const & x2);
216 
217 protected:
219  ~vtkPiecewiseFunction() VTK_OVERRIDE;
220 
221  // Internal method to sort the vector and update the
222  // Range whenever a node is added, edited or removed.
223  // It always calls Modified().
224  void SortAndUpdateRange();
225  // Returns true if the range has been updated and Modified() has been called
226  bool UpdateRange();
227 
231  double FindMinimumXDistance();
232 
233  // The internal STL structures
234  vtkPiecewiseFunctionInternals *Internal;
235 
236  // Determines the function value outside of defined points
237  // Zero = always return 0.0 outside of defined points
238  // One = clamp to the lowest value below defined points and
239  // highest value above defined points
240  int Clamping;
241 
242  // Array of points ((X,Y) pairs)
243  double *Function;
244 
245  // Min and max range of function point locations
246  double Range[2];
247 
248  int AllowDuplicateScalars;
249 
250 private:
251  vtkPiecewiseFunction(const vtkPiecewiseFunction&) VTK_DELETE_FUNCTION;
252  void operator=(const vtkPiecewiseFunction&) VTK_DELETE_FUNCTION;
253 };
254 
255 #endif
256 
257 
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * New()
#define VTK_PIECEWISE_FUNCTION
Definition: vtkType.h:92
Defines a 1D piecewise function.
Store vtkAlgorithm input/output information.
virtual void Initialize()
Restore data object to initial state,.
int GetDataObjectType() override
Return what type of dataset this is.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.