File: vtkLinearExtrusionFilter.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (133 lines) | stat: -rw-r--r-- 4,589 bytes parent folder | download | duplicates (6)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkLinearExtrusionFilter
 * @brief   sweep polygonal data creating a "skirt" from free edges and lines, and lines from
 * vertices
 *
 * vtkLinearExtrusionFilter is a modeling filter. It takes polygonal data as
 * input and generates polygonal data on output. The input dataset is swept
 * according to some extrusion function and creates new polygonal primitives.
 * These primitives form a "skirt" or swept surface. For example, sweeping a
 * line results in a quadrilateral, and sweeping a triangle creates a "wedge".
 *
 * There are a number of control parameters for this filter. You can
 * control whether the sweep of a 2D object (i.e., polygon or triangle strip)
 * is capped with the generating geometry via the "Capping" ivar. Also, you
 * can extrude in the direction of a user specified vector, towards a point,
 * or in the direction of vertex normals (normals must be provided - use
 * vtkPolyDataNormals if necessary). The amount of extrusion is controlled by
 * the "ScaleFactor" instance variable.
 *
 * The skirt is generated by locating certain topological features. Free
 * edges (edges of polygons or triangle strips only used by one polygon or
 * triangle strips) generate surfaces. This is true also of lines or
 * polylines. Vertices generate lines.
 *
 * This filter can be used to create 3D fonts, 3D irregular bar charts,
 * or to model 2 1/2D objects like punched plates. It also can be used to
 * create solid objects from 2D polygonal meshes.
 *
 * @warning
 * Some polygonal objects have no free edges (e.g., sphere). When swept,
 * this will result in two separate surfaces if capping is on, or no surface
 * if capping is off.
 *
 * @sa
 * vtkRotationalExtrusionFilter
 */

#ifndef vtkLinearExtrusionFilter_h
#define vtkLinearExtrusionFilter_h

#include "vtkFiltersModelingModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"

VTK_ABI_NAMESPACE_BEGIN
class vtkDataArray;

#define VTK_VECTOR_EXTRUSION 1
#define VTK_NORMAL_EXTRUSION 2
#define VTK_POINT_EXTRUSION 3

class VTKFILTERSMODELING_EXPORT vtkLinearExtrusionFilter : public vtkPolyDataAlgorithm
{
public:
  vtkTypeMacro(vtkLinearExtrusionFilter, vtkPolyDataAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  /**
   * Create object with normal extrusion type, capping on, scale factor=1.0,
   * vector (0,0,1), and extrusion point (0,0,0).
   */
  static vtkLinearExtrusionFilter* New();

  ///@{
  /**
   * Set/Get the type of extrusion.
   */
  vtkSetClampMacro(ExtrusionType, int, VTK_VECTOR_EXTRUSION, VTK_POINT_EXTRUSION);
  vtkGetMacro(ExtrusionType, int);
  void SetExtrusionTypeToVectorExtrusion() { this->SetExtrusionType(VTK_VECTOR_EXTRUSION); }
  void SetExtrusionTypeToNormalExtrusion() { this->SetExtrusionType(VTK_NORMAL_EXTRUSION); }
  void SetExtrusionTypeToPointExtrusion() { this->SetExtrusionType(VTK_POINT_EXTRUSION); }
  ///@}

  ///@{
  /**
   * Turn on/off the capping of the skirt.
   */
  vtkSetMacro(Capping, vtkTypeBool);
  vtkGetMacro(Capping, vtkTypeBool);
  vtkBooleanMacro(Capping, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Set/Get extrusion scale factor,
   */
  vtkSetMacro(ScaleFactor, double);
  vtkGetMacro(ScaleFactor, double);
  ///@}

  ///@{
  /**
   * Set/Get extrusion vector. Only needs to be set if VectorExtrusion is
   * turned on.
   */
  vtkSetVector3Macro(Vector, double);
  vtkGetVectorMacro(Vector, double, 3);
  ///@}

  ///@{
  /**
   * Set/Get extrusion point. Only needs to be set if PointExtrusion is
   * turned on. This is the point towards which extrusion occurs.
   */
  vtkSetVector3Macro(ExtrusionPoint, double);
  vtkGetVectorMacro(ExtrusionPoint, double, 3);
  ///@}

protected:
  vtkLinearExtrusionFilter();
  ~vtkLinearExtrusionFilter() override = default;

  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
  int ExtrusionType;
  vtkTypeBool Capping;
  double ScaleFactor;
  double Vector[3];
  double ExtrusionPoint[3];

  void (vtkLinearExtrusionFilter::*ExtrudePoint)(double x[3], vtkIdType id, vtkDataArray* normals);
  void ViaNormal(double x[3], vtkIdType id, vtkDataArray* normals);
  void ViaVector(double x[3], vtkIdType id, vtkDataArray* normals = nullptr);
  void ViaPoint(double x[3], vtkIdType id, vtkDataArray* normals = nullptr);

private:
  vtkLinearExtrusionFilter(const vtkLinearExtrusionFilter&) = delete;
  void operator=(const vtkLinearExtrusionFilter&) = delete;
};

VTK_ABI_NAMESPACE_END
#endif