00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00027 #ifndef __vtkPlane_h
00028 #define __vtkPlane_h
00029
00030 #include "vtkImplicitFunction.h"
00031
00032 class VTK_COMMON_EXPORT vtkPlane : public vtkImplicitFunction
00033 {
00034 public:
00036 static vtkPlane *New();
00037
00038 vtkTypeRevisionMacro(vtkPlane,vtkImplicitFunction);
00039 void PrintSelf(ostream& os, vtkIndent indent);
00040
00042
00043 double EvaluateFunction(double x[3]);
00044 double EvaluateFunction(double x, double y, double z)
00045 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;
00047
00049 void EvaluateGradient(double x[3], double g[3]);
00050
00052
00053 vtkSetVector3Macro(Normal,double);
00054 vtkGetVectorMacro(Normal,double,3);
00056
00058
00060 vtkSetVector3Macro(Origin,double);
00061 vtkGetVectorMacro(Origin,double,3);
00063
00066 void Push(double distance);
00067
00069
00072 static void ProjectPoint(double x[3], double origin[3], double normal[3],
00073 double xproj[3]);
00075
00077
00080 static void GeneralizedProjectPoint(double x[3], double origin[3],
00081 double normal[3], double xproj[3]);
00083
00085 static double Evaluate(double normal[3], double origin[3], double x[3]);
00086
00089 static double DistanceToPlane(double x[3], double n[3], double p0[3]);
00090
00092
00098 static int IntersectWithLine(double p1[3], double p2[3], double n[3],
00099 double p0[3], double& t, double x[3]);
00101
00102
00103 protected:
00104 vtkPlane();
00105 ~vtkPlane() {};
00106
00107 double Normal[3];
00108 double Origin[3];
00109
00110 private:
00111 vtkPlane(const vtkPlane&);
00112 void operator=(const vtkPlane&);
00113 };
00114
00115 inline double vtkPlane::Evaluate(double normal[3],
00116 double origin[3], double x[3])
00117 {
00118 return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
00119 normal[2]*(x[2]-origin[2]);
00120 }
00121
00122 inline double vtkPlane::DistanceToPlane(double x[3], double n[3], double p0[3])
00123 {
00124 #define vtkPlaneAbs(x) ((x)<0?-(x):(x))
00125 return (vtkPlaneAbs(n[0]*(x[0]-p0[0]) + n[1]*(x[1]-p0[1]) +
00126 n[2]*(x[2]-p0[2])));
00127 }
00128
00129 #endif
00130
00131