File: vtkPlanes.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 118,532 kB
  • ctags: 138,251
  • sloc: cpp: 1,443,749; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,127; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 471; makefile: 95; objc: 17
file content (117 lines) | stat: -rw-r--r-- 4,020 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:    vtkPlanes.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 vtkPlanes - implicit function for convex set of planes
// .SECTION Description
// vtkPlanes computes the implicit function and function gradient for a set
// of planes. The planes must define a convex space.
//
// The function value is the closest first order distance of a point to the
// convex region defined by the planes. The function gradient is the plane
// normal at the function value.  Note that the normals must point outside of
// the convex region. Thus, a negative function value means that a point is
// inside the convex region.
//
// There are several methods to define the set of planes. The most general is
// to supply an instance of vtkPoints and an instance of vtkDataArray. (The
// points define a point on the plane, and the normals corresponding plane
// normals.) Two other specialized ways are to 1) supply six planes defining
// the view frustrum of a camera, and 2) provide a bounding box.

// .SECTION See Also
// vtkCamera

#ifndef vtkPlanes_h
#define vtkPlanes_h

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

class vtkPlane;
class vtkPoints;
class vtkDataArray;

class VTKCOMMONDATAMODEL_EXPORT vtkPlanes : public vtkImplicitFunction
{
public:
  static vtkPlanes *New();
  vtkTypeMacro(vtkPlanes,vtkImplicitFunction);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description
  // Evaluate plane equations. Return smallest absolute value.
  double EvaluateFunction(double x[3]);
  double EvaluateFunction(double x, double y, double z)
    {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;

  // Description
  // Evaluate planes gradient.
  void EvaluateGradient(double x[3], double n[3]);

  // Description:
  // Specify a list of points defining points through which the planes pass.
  virtual void SetPoints(vtkPoints*);
  vtkGetObjectMacro(Points,vtkPoints);

  // Description:
  // Specify a list of normal vectors for the planes. There is a one-to-one
  // correspondence between plane points and plane normals.
  void SetNormals(vtkDataArray* normals);
  vtkGetObjectMacro(Normals,vtkDataArray);

  // Description:
  // An alternative method to specify six planes defined by the camera view
  // frustrum. See vtkCamera::GetFrustumPlanes() documentation.
  void SetFrustumPlanes(double planes[24]);

  // Description:
  // An alternative method to specify six planes defined by a bounding box.
  // The bounding box is a six-vector defined as (xmin,xmax,ymin,ymax,zmin,zmax).
  // It defines six planes orthogonal to the x-y-z coordinate axes.
  void SetBounds(const double bounds[6]);
  void SetBounds(double xmin, double xmax, double ymin, double ymax,
                 double zmin, double zmax);

  // Description:
  // Return the number of planes in the set of planes.
  int GetNumberOfPlanes();

  // Description:
  // Create and return a pointer to a vtkPlane object at the ith
  // position. Asking for a plane outside the allowable range returns NULL.
  // This method always returns the same object.
  // Use GetPlane(int i, vtkPlane *plane) instead
  vtkPlane *GetPlane(int i);
  void GetPlane(int i, vtkPlane *plane);

protected:
  vtkPlanes();
  ~vtkPlanes();

  vtkPoints *Points;
  vtkDataArray *Normals;
  vtkPlane *Plane;

private:
  double Planes[24];
  double Bounds[6];

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

#endif