File: vtkPolyDataPointSampler.h

package info (click to toggle)
vtk 5.8.0-13
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 130,524 kB
  • sloc: cpp: 1,129,256; ansic: 708,203; tcl: 48,526; python: 20,875; xml: 6,779; yacc: 4,208; perl: 3,121; java: 2,788; lex: 931; sh: 660; asm: 471; makefile: 299
file content (117 lines) | stat: -rw-r--r-- 4,486 bytes parent folder | download | duplicates (4)
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
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataPointSampler.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.

=========================================================================*/
// .NAME vtkPolyDataPointSampler - generate points from vtkPolyData
// .SECTION Description
// vtkPolyDataPointSampler generates points from input vtkPolyData. The
// points are placed approximately a specified distance apart.
//
// This filter functions as follows. First, it regurgitates all input points,
// then samples all lines, plus edges associated with the input polygons and
// triangle strips to produce edge points. Finally, the interiors of polygons
// and triangle strips are subsampled to produce points.  All of these
// functiona can be enabled or disabled separately. Note that this algorithm
// only approximately generates points the specified distance apart. 
// Generally the point density is finer than requested.
//
// .SECTION Caveats
// Point generation can be useful in a variety of applications. For example,
// generating seed points for glyphing or streamline generation. Another
// useful application is generating points for implicit modeling. In many
// cases implicit models can be more efficiently generated from points than
// from polygons or other primitives.

// .SECTION See Also
// vtkImplicitModeller

#ifndef __vtkPolyDataPointSampler_h
#define __vtkPolyDataPointSampler_h

#include "vtkPolyDataAlgorithm.h"

class VTK_GRAPHICS_EXPORT vtkPolyDataPointSampler : public vtkPolyDataAlgorithm 
{
public:
  // Description:
  // Instantiate this class.
  static vtkPolyDataPointSampler *New();

  // Description:
  // Standard macros for type information and printing.
  vtkTypeMacro(vtkPolyDataPointSampler,vtkPolyDataAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set/Get the approximate distance between points. This is an absolute
  // distance measure. The default is 0.01.
  vtkSetClampMacro(Distance,double,0.0,VTK_LARGE_FLOAT);
  vtkGetMacro(Distance,double);
  
  // Description:
  // Specify/retrieve a boolean flag indicating whether cell vertex points should
  // be output.
  vtkGetMacro(GenerateVertexPoints,int);  
  vtkSetMacro(GenerateVertexPoints,int);  
  vtkBooleanMacro(GenerateVertexPoints,int);  

  // Description:
  // Specify/retrieve a boolean flag indicating whether cell edges should
  // be sampled to produce output points. The default is true.
  vtkGetMacro(GenerateEdgePoints,int);  
  vtkSetMacro(GenerateEdgePoints,int);  
  vtkBooleanMacro(GenerateEdgePoints,int);  

  // Description:
  // Specify/retrieve a boolean flag indicating whether cell interiors should
  // be sampled to produce output points. The default is true.
  vtkGetMacro(GenerateInteriorPoints,int);  
  vtkSetMacro(GenerateInteriorPoints,int);  
  vtkBooleanMacro(GenerateInteriorPoints,int);  

  // Description:
  // Specify/retrieve a boolean flag indicating whether cell vertices should
  // be generated. Cell vertices are useful if you actually want to display
  // the points (that is, for each point generated, a vertex is generated).
  // Recall that VTK only renders vertices and not points. 
  // The default is true.
  vtkGetMacro(GenerateVertices,int);  
  vtkSetMacro(GenerateVertices,int);  
  vtkBooleanMacro(GenerateVertices,int);  

protected:
  vtkPolyDataPointSampler();
  ~vtkPolyDataPointSampler() {}

  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);

  double Distance;
  double Distance2;
  
  int GenerateVertexPoints;
  int GenerateEdgePoints;
  int GenerateInteriorPoints;
  int GenerateVertices;

  void SampleEdge(vtkPoints *pts, double x0[3], double x1[3]);
  void SampleTriangle(vtkPoints *newPts, vtkPoints *inPts, 
                      vtkIdType *pts);
  void SamplePolygon(vtkPoints *newPts, vtkPoints *inPts, 
                      vtkIdType npts, vtkIdType *pts);

private:
  vtkPolyDataPointSampler(const vtkPolyDataPointSampler&);  // Not implemented.
  void operator=(const vtkPolyDataPointSampler&);  // Not implemented.
};

#endif