forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkBezierContourLineInterpolator.h
110 lines (90 loc) · 3.58 KB
/
vtkBezierContourLineInterpolator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*=========================================================================
Program: Visualization Toolkit
Module: vtkBezierContourLineInterpolator.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkBezierContourLineInterpolator
* @brief Interpolates supplied nodes with bezier line segments
*
* The line interpolator interpolates supplied nodes (see InterpolateLine)
* with Bezier line segments. The fitness of the curve may be controlled using
* SetMaximumCurveError and SetMaximumNumberOfLineSegments.
*
* @sa
* vtkContourLineInterpolator
*/
#ifndef vtkBezierContourLineInterpolator_h
#define vtkBezierContourLineInterpolator_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkContourLineInterpolator.h"
class VTKINTERACTIONWIDGETS_EXPORT vtkBezierContourLineInterpolator
: public vtkContourLineInterpolator
{
public:
/**
* Instantiate this class.
*/
static vtkBezierContourLineInterpolator *New();
//@{
/**
* Standard methods for instances of this class.
*/
vtkTypeMacro(vtkBezierContourLineInterpolator, vtkContourLineInterpolator);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
int InterpolateLine( vtkRenderer *ren,
vtkContourRepresentation *rep,
int idx1, int idx2 ) override;
//@{
/**
* The difference between a line segment connecting two points and the curve
* connecting the same points. In the limit of the length of the curve
* dx -> 0, the two values will be the same. The smaller this number, the
* finer the bezier curve will be interpolated. Default is 0.005
*/
vtkSetClampMacro(MaximumCurveError, double, 0.0, VTK_DOUBLE_MAX);
vtkGetMacro(MaximumCurveError, double);
//@}
//@{
/**
* Maximum number of bezier line segments between two nodes. Larger values
* create a finer interpolation. Default is 100.
*/
vtkSetClampMacro(MaximumCurveLineSegments, int, 1, 1000);
vtkGetMacro(MaximumCurveLineSegments, int);
//@}
/**
* Span of the interpolator, i.e. the number of control points it's supposed
* to interpolate given a node.
* The first argument is the current nodeIndex.
* i.e., you'd be trying to interpolate between nodes "nodeIndex" and
* "nodeIndex-1", unless you're closing the contour, in which case you're
* trying to interpolate "nodeIndex" and "Node=0". The node span is
* returned in a vtkIntArray.
* The node span is returned in a vtkIntArray. The node span returned by
* this interpolator will be a 2-tuple with a span of 4.
*/
void GetSpan(int nodeIndex, vtkIntArray *nodeIndices,
vtkContourRepresentation *rep) override;
protected:
vtkBezierContourLineInterpolator();
~vtkBezierContourLineInterpolator() override;
void ComputeMidpoint(double p1[3], double p2[3], double mid[3])
{
mid[0] = (p1[0] + p2[0])/2;
mid[1] = (p1[1] + p2[1])/2;
mid[2] = (p1[2] + p2[2])/2;
}
double MaximumCurveError;
int MaximumCurveLineSegments;
private:
vtkBezierContourLineInterpolator(const vtkBezierContourLineInterpolator&) = delete;
void operator=(const vtkBezierContourLineInterpolator&) = delete;
};
#endif