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) override;
57 
58  void DeepCopy( vtkDataObject *f ) override;
59  void ShallowCopy( vtkDataObject *f ) override;
60 
64  int GetDataObjectType() 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 
145  void GetTable( double x1, double x2, int size, float *table, int stride=1, int logIncrements=0 );
146  void GetTable( double x1, double x2, int size, double *table, int stride=1, int logIncrements=0 );
148 
155  void BuildFunctionFromTable( double x1, double x2, int size,
156  double *table, int stride=1 );
157 
159 
167  vtkSetMacro( Clamping, vtkTypeBool );
168  vtkGetMacro( Clamping, vtkTypeBool );
169  vtkBooleanMacro( Clamping, vtkTypeBool );
171 
177  vtkSetMacro(UseLogScale, bool)
178  vtkGetMacro(UseLogScale, bool)
179  vtkBooleanMacro(UseLogScale, bool)
190  const char *GetType();
191 
196  double GetFirstNonZeroValue();
197 
203  void Initialize() override;
204 
206 
212 
214 
218  vtkSetMacro(AllowDuplicateScalars, vtkTypeBool);
219  vtkGetMacro(AllowDuplicateScalars, vtkTypeBool);
220  vtkBooleanMacro(AllowDuplicateScalars, vtkTypeBool);
222 
227  int EstimateMinNumberOfSamples(double const & x1, double const & x2);
228 
229 protected:
231  ~vtkPiecewiseFunction() override;
232 
233  // Internal method to sort the vector and update the
234  // Range whenever a node is added, edited or removed.
235  // It always calls Modified().
236  void SortAndUpdateRange();
237  // Returns true if the range has been updated and Modified() has been called
238  bool UpdateRange();
239 
243  double FindMinimumXDistance();
244 
245  // The internal STL structures
246  vtkPiecewiseFunctionInternals *Internal;
247 
248  // Determines the function value outside of defined points
249  // Zero = always return 0.0 outside of defined points
250  // One = clamp to the lowest value below defined points and
251  // highest value above defined points
253 
254  // Array of points ((X,Y) pairs)
255  double *Function;
256 
257  // Min and max range of function point locations
258  double Range[2];
259 
261 
263 
264 private:
266  void operator=(const vtkPiecewiseFunction&) = delete;
267 };
268 
269 #endif
270 
271 
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
static vtkDataObject * New()
#define VTK_PIECEWISE_FUNCTION
Definition: vtkType.h:96
Defines a 1D piecewise function.
Store vtkAlgorithm input/output information.
virtual void Initialize()
Restore data object to initial state,.
int vtkTypeBool
Definition: vtkABI.h:69
int GetDataObjectType() override
Return what type of dataset this is.
a simple class to control print indentation
Definition: vtkIndent.h:39
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkPiecewiseFunctionInternals * Internal
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.