VTK
vtkPlane.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlane.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkPlane_h
31 #define vtkPlane_h
32 
33 #include "vtkCommonDataModelModule.h" // For export macro
34 #include "vtkImplicitFunction.h"
35 
37 {
38 public:
40  static vtkPlane *New();
41 
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
46 
47  double EvaluateFunction(double x[3]);
48  double EvaluateFunction(double x, double y, double z)
49  {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;
51 
53  void EvaluateGradient(double x[3], double g[3]);
54 
56 
57  vtkSetVector3Macro(Normal,double);
58  vtkGetVectorMacro(Normal,double,3);
60 
62 
64  vtkSetVector3Macro(Origin,double);
65  vtkGetVectorMacro(Origin,double,3);
67 
70  void Push(double distance);
71 
73 
76  static void ProjectPoint(double x[3], double origin[3], double normal[3],
77  double xproj[3]);
78  void ProjectPoint(double x[3], double xproj[3]);
80 
82 
84  static void ProjectVector(double v[3], double origin[3], double normal[3],
85  double vproj[3]);
86  void ProjectVector(double v[3], double vproj[3]);
88 
90 
93  static void GeneralizedProjectPoint(double x[3], double origin[3],
94  double normal[3], double xproj[3]);
95  void GeneralizedProjectPoint(double x[3], double xproj[3]);
97 
98 
100  static double Evaluate(double normal[3], double origin[3], double x[3]);
101 
103 
105  static double DistanceToPlane(double x[3], double n[3], double p0[3]);
106  double DistanceToPlane(double x[3]);
108 
110 
116  static int IntersectWithLine(double p1[3], double p2[3], double n[3],
117  double p0[3], double& t, double x[3]);
118  int IntersectWithLine(double p1[3], double p2[3], double& t, double x[3]);
120 
121 protected:
122  vtkPlane();
124 
125  double Normal[3];
126  double Origin[3];
127 
128 private:
129  vtkPlane(const vtkPlane&); // Not implemented.
130  void operator=(const vtkPlane&); // Not implemented.
131 };
132 
133 inline double vtkPlane::Evaluate(double normal[3],
134  double origin[3], double x[3])
135 {
136  return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
137  normal[2]*(x[2]-origin[2]);
138 }
139 
140 inline double vtkPlane::DistanceToPlane(double x[3], double n[3], double p0[3])
141 {
142 #define vtkPlaneAbs(x) ((x)<0?-(x):(x))
143  return (vtkPlaneAbs(n[0]*(x[0]-p0[0]) + n[1]*(x[1]-p0[1]) +
144  n[2]*(x[2]-p0[2])));
145 }
146 
147 #endif
148 
149 
abstract interface for implicit functions
~vtkPlane()
Definition: vtkPlane.h:123
virtual double EvaluateFunction(double x[3])=0
static double DistanceToPlane(double x[3], double n[3], double p0[3])
Definition: vtkPlane.h:140
static double Evaluate(double normal[3], double origin[3], double x[3])
Definition: vtkPlane.h:133
#define vtkPlaneAbs(x)
virtual void EvaluateGradient(double x[3], double g[3])=0
a simple class to control print indentation
Definition: vtkIndent.h:38
double EvaluateFunction(double x, double y, double z)
Definition: vtkPlane.h:48
perform various plane computations
Definition: vtkPlane.h:36
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
#define VTKCOMMONDATAMODEL_EXPORT