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 
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:
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 
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkPlane::Evaluate
static double Evaluate(double normal[3], double origin[3], double x[3])
Definition: vtkPlane.h:133
vtkPlane::ProjectPoint
void ProjectPoint(double x[3], double xproj[3])
vtkSetVector3Macro
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:287
vtkCommonDataModelModule.h
vtkPlane::ProjectPoint
static void ProjectPoint(double x[3], double origin[3], double normal[3], double xproj[3])
vtkX3D::Normal
@ Normal
Definition: vtkX3D.h:45
vtkImplicitFunction::EvaluateFunction
virtual double EvaluateFunction(double x[3])=0
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkPlane::EvaluateFunction
double EvaluateFunction(double x[3])
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkPlane::EvaluateFunction
double EvaluateFunction(double x, double y, double z)
Definition: vtkPlane.h:48
vtkPlane::GeneralizedProjectPoint
static void GeneralizedProjectPoint(double x[3], double origin[3], double normal[3], double xproj[3])
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkGetVectorMacro
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:424
vtkPlane::ProjectVector
void ProjectVector(double v[3], double vproj[3])
vtkPlaneAbs
#define vtkPlaneAbs(x)
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:58
vtkPlane::IntersectWithLine
static int IntersectWithLine(double p1[3], double p2[3], double n[3], double p0[3], double &t, double x[3])
vtkPlane::EvaluateGradient
void EvaluateGradient(double x[3], double g[3])
vtkPlane::DistanceToPlane
static double DistanceToPlane(double x[3], double n[3], double p0[3])
Definition: vtkPlane.h:140
vtkPlane::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkPlane::~vtkPlane
~vtkPlane()
Definition: vtkPlane.h:123
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPlane::IntersectWithLine
int IntersectWithLine(double p1[3], double p2[3], double &t, double x[3])
vtkPlane::ProjectVector
static void ProjectVector(double v[3], double origin[3], double normal[3], double vproj[3])
vtkPlane::DistanceToPlane
double DistanceToPlane(double x[3])
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
vtkPlane::Push
void Push(double distance)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkPlane::vtkPlane
vtkPlane()
vtkPlane::GeneralizedProjectPoint
void GeneralizedProjectPoint(double x[3], double xproj[3])
vtkImplicitFunction.h
vtkPlane::New
static vtkPlane * New()
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15