File: vtkPath.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 205,984 kB
  • sloc: cpp: 2,336,570; 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: 181; javascript: 165; objc: 153; tcl: 59
file content (137 lines) | stat: -rw-r--r-- 3,835 bytes parent folder | download
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
134
135
136
137
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkPath
 * @brief   concrete dataset representing a path defined by Bezier
 * curves.
 *
 * vtkPath provides a container for paths composed of line segments,
 * 2nd-order (quadratic) and 3rd-order (cubic) Bezier curves.
 */

#ifndef vtkPath_h
#define vtkPath_h

#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkPointSet.h"

VTK_ABI_NAMESPACE_BEGIN
class vtkIntArray;

class VTKCOMMONDATAMODEL_EXPORT vtkPath : public vtkPointSet
{
public:
  static vtkPath* New();

  vtkTypeMacro(vtkPath, vtkPointSet);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  /**
   * Return what type of dataset this is.
   */
  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_PATH; }

  /**
   * Enumeration of recognized control point types:
   * - MOVE_TO: Point defining the origin of a new segment, not connected to
   * the previous point.
   * - LINE_TO: Draw a line from the previous point to the current one
   * - CONIC_CURVE: 2nd order (conic/quadratic) point. Must appear
   * in sets of 2, e.g. (0,0) MOVE_TO (0,1) CONIC_CURVE (1,2) CONIC_CURVE
   * defines a quadratic Bezier curve that passes through (0,0) and (1,2)
   * using (0,1) as a control (off) point.
   * - CUBIC_CURVE: 3rd order (cubic) control point. Must appear in sets of
   * 3, e.g. (0,0) MOVE_TO (0,1) CUBIC_CURVE (1,2) CUBIC_CURVE (4,0)
   * CUBIC_CURVE defines a cubic Bezier curve that passes through (0,0)
   * and (4,0), using (0,1) and (1,2) as control (off) points.
   */
  enum ControlPointType
  {
    MOVE_TO = 0,
    LINE_TO,
    CONIC_CURVE,
    CUBIC_CURVE
  };

  ///@{
  /**
   * Insert the next control point in the path.
   */
  void InsertNextPoint(float pts[3], int code);
  void InsertNextPoint(double pts[3], int code);
  void InsertNextPoint(double x, double y, double z, int code);
  ///@}

  ///@{
  /**
   * Set/Get the array of control point codes:
   */
  void SetCodes(vtkIntArray*);
  vtkIntArray* GetCodes();
  ///@}

  /**
   * vtkPath doesn't use cells. These methods return trivial values.
   */
  vtkIdType GetNumberOfCells() override { return 0; }
  using vtkDataSet::GetCell;
  vtkCell* GetCell(vtkIdType) override { return nullptr; }
  void GetCell(vtkIdType, vtkGenericCell*) override;
  int GetCellType(vtkIdType) override { return 0; }

  using vtkDataSet::GetCellPoints;
  /**
   * vtkPath doesn't use cells, this method just clears ptIds.
   */
  void GetCellPoints(vtkIdType, vtkIdList* ptIds) override;

  /**
   * vtkPath doesn't use cells, this method just clears cellIds.
   */
  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override;

  /**
   * Return the maximum cell size in this poly data.
   */
  int GetMaxCellSize() override { return 0; }

  ///@{
  /**
   * Get the maximum/minimum spatial dimensionality of the data
   * which is the maximum/minimum dimension of all cells.
   */
  int GetMaxSpatialDimension() override { return 0; }
  int GetMinSpatialDimension() override { return 0; }
  ///@}

  /**
   * Method allocates initial storage for points. Use this method before the
   * method vtkPath::InsertNextPoint().
   */
  void Allocate(vtkIdType size = 1000, int extSize = 1000);

  /**
   * Begin inserting data all over again. Memory is not freed but otherwise
   * objects are returned to their initial state.
   */
  void Reset();

  ///@{
  /**
   * Retrieve an instance of this class from an information object.
   */
  static vtkPath* GetData(vtkInformation* info);
  static vtkPath* GetData(vtkInformationVector* v, int i = 0);
  ///@}

protected:
  vtkPath();
  ~vtkPath() override;

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

VTK_ABI_NAMESPACE_END
#endif