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:
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
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 
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 
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().
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 
vtkPiecewiseFunction::BuildFunctionFromTable
void BuildFunctionFromTable(double x1, double x2, int size, double *table, int stride=1)
vtkPiecewiseFunction::GetDataObjectType
int GetDataObjectType()
Definition: vtkPiecewiseFunction.h:61
vtkPiecewiseFunction::Clamping
int Clamping
Definition: vtkPiecewiseFunction.h:186
vtkGetVector2Macro
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:270
vtkPiecewiseFunction::RemovePoint
int RemovePoint(double x)
vtkPiecewiseFunction::GetData
static vtkPiecewiseFunction * GetData(vtkInformation *info)
vtkCommonDataModelModule.h
vtkPiecewiseFunction::AllowDuplicateScalars
int AllowDuplicateScalars
Definition: vtkPiecewiseFunction.h:201
vtkPiecewiseFunction::GetNodeValue
int GetNodeValue(int index, double val[4])
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkPiecewiseFunction::GetTable
void GetTable(double x1, double x2, int size, float *table, int stride=1)
vtkPiecewiseFunction::AdjustRange
int AdjustRange(double range[2])
vtkPiecewiseFunction::FillFromDataPointer
void FillFromDataPointer(int, double *)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkPiecewiseFunction::SortAndUpdateRange
void SortAndUpdateRange()
vtkPiecewiseFunction::Initialize
void Initialize()
vtkgl::table
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: vtkgl.h:11332
vtkgl::range
GLenum GLint * range
Definition: vtkgl.h:14180
vtkPiecewiseFunction::AddPoint
int AddPoint(double x, double y, double midpoint, double sharpness)
vtkPiecewiseFunction::Function
double * Function
Definition: vtkPiecewiseFunction.h:189
vtkgl::stride
GLsizei stride
Definition: vtkgl.h:11728
vtkPiecewiseFunction::GetDataPointer
double * GetDataPointer()
vtkgl::val
GLuint GLfloat * val
Definition: vtkgl.h:13789
vtkPiecewiseFunction::Internal
vtkPiecewiseFunctionInternals * Internal
Definition: vtkPiecewiseFunction.h:180
vtkPiecewiseFunction::GetTable
void GetTable(double x1, double x2, int size, double *table, int stride=1)
vtkPiecewiseFunction::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkPiecewiseFunction::ShallowCopy
void ShallowCopy(vtkDataObject *f)
vtkPiecewiseFunction::GetType
const char * GetType()
vtkPiecewiseFunction::New
static vtkPiecewiseFunction * New()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPiecewiseFunction::GetFirstNonZeroValue
double GetFirstNonZeroValue()
vtkPiecewiseFunction::~vtkPiecewiseFunction
~vtkPiecewiseFunction()
vtkPiecewiseFunction::SetNodeValue
int SetNodeValue(int index, double val[4])
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:51
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkPiecewiseFunction::GetData
static vtkPiecewiseFunction * GetData(vtkInformationVector *v, int i=0)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkPiecewiseFunction::GetSize
int GetSize()
vtkDataObject.h
vtkPiecewiseFunction::AddPoint
int AddPoint(double x, double y)
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
vtkPiecewiseFunction::GetValue
double GetValue(double x)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkPiecewiseFunction::vtkPiecewiseFunction
vtkPiecewiseFunction()
vtkPiecewiseFunction::RemoveAllPoints
void RemoveAllPoints()
VTK_PIECEWISE_FUNCTION
#define VTK_PIECEWISE_FUNCTION
Definition: vtkType.h:71
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
vtkPiecewiseFunction::UpdateRange
bool UpdateRange()
vtkPiecewiseFunction::AddSegment
void AddSegment(double x1, double y1, double x2, double y2)
vtkPiecewiseFunction::DeepCopy
void DeepCopy(vtkDataObject *f)