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 "vtkImplicitFunction.h"
34 
36 {
37 public:
39  static vtkPlane *New();
40 
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
45 
46  double EvaluateFunction(double x[3]);
47  double EvaluateFunction(double x, double y, double z)
48  {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;
50 
52  void EvaluateGradient(double x[3], double g[3]);
53 
55 
56  vtkSetVector3Macro(Normal,double);
57  vtkGetVectorMacro(Normal,double,3);
59 
61 
63  vtkSetVector3Macro(Origin,double);
64  vtkGetVectorMacro(Origin,double,3);
66 
69  void Push(double distance);
70 
72 
75  static void ProjectPoint(double x[3], double origin[3], double normal[3],
76  double xproj[3]);
77  void ProjectPoint(double x[3], double xproj[3]);
79 
81 
84  static void GeneralizedProjectPoint(double x[3], double origin[3],
85  double normal[3], double xproj[3]);
86  void GeneralizedProjectPoint(double x[3], double xproj[3]);
88 
89 
91  static double Evaluate(double normal[3], double origin[3], double x[3]);
92 
94 
96  static double DistanceToPlane(double x[3], double n[3], double p0[3]);
97  double DistanceToPlane(double x[3]);
99 
101 
107  static int IntersectWithLine(double p1[3], double p2[3], double n[3],
108  double p0[3], double& t, double x[3]);
109  int IntersectWithLine(double p1[3], double p2[3], double& t, double x[3]);
111 
112 protected:
113  vtkPlane();
114  ~vtkPlane() {};
115 
116  double Normal[3];
117  double Origin[3];
118 
119 private:
120  vtkPlane(const vtkPlane&); // Not implemented.
121  void operator=(const vtkPlane&); // Not implemented.
122 };
123 
124 inline double vtkPlane::Evaluate(double normal[3],
125  double origin[3], double x[3])
126 {
127  return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
128  normal[2]*(x[2]-origin[2]);
129 }
130 
131 inline double vtkPlane::DistanceToPlane(double x[3], double n[3], double p0[3])
132 {
133 #define vtkPlaneAbs(x) ((x)<0?-(x):(x))
134  return (vtkPlaneAbs(n[0]*(x[0]-p0[0]) + n[1]*(x[1]-p0[1]) +
135  n[2]*(x[2]-p0[2])));
136 }
137 
138 #endif
139 
140 
abstract interface for implicit functions
~vtkPlane()
Definition: vtkPlane.h:114
virtual double EvaluateFunction(double x[3])=0
static double DistanceToPlane(double x[3], double n[3], double p0[3])
Definition: vtkPlane.h:131
static double Evaluate(double normal[3], double origin[3], double x[3])
Definition: vtkPlane.h:124
#define vtkPlaneAbs(x)
virtual void EvaluateGradient(double x[3], double g[3])=0
a simple class to control print indentation
Definition: vtkIndent.h:37
double EvaluateFunction(double x, double y, double z)
Definition: vtkPlane.h:47
perform various plane computations
Definition: vtkPlane.h:35
#define VTK_COMMON_EXPORT
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()