Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Common/vtkPlane.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00047 #ifndef __vtkPlane_h
00048 #define __vtkPlane_h
00049
00050 #include "vtkImplicitFunction.h"
00051
00052 class VTK_COMMON_EXPORT vtkPlane : public vtkImplicitFunction
00053 {
00054 public:
00056 static vtkPlane *New();
00057
00058 vtkTypeRevisionMacro(vtkPlane,vtkImplicitFunction);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062
00063 float EvaluateFunction(float x[3]);
00064 float EvaluateFunction(float x, float y, float z)
00065 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;
00067
00069 void EvaluateGradient(float x[3], float g[3]);
00070
00072
00073 vtkSetVector3Macro(Normal,float);
00074 vtkGetVectorMacro(Normal,float,3);
00076
00078
00080 vtkSetVector3Macro(Origin,float);
00081 vtkGetVectorMacro(Origin,float,3);
00083
00086 void Push(float distance);
00087
00089
00092 static void ProjectPoint(float x[3], float origin[3], float normal[3],
00093 float xproj[3]);
00094 static void ProjectPoint(double x[3], double origin[3], double normal[3],
00095 double xproj[3]);
00097
00099
00102 static void GeneralizedProjectPoint(float x[3], float origin[3],
00103 float normal[3], float xproj[3]);
00105
00107
00108 static float Evaluate(float normal[3], float origin[3], float x[3]);
00109 static float Evaluate(double normal[3], double origin[3], double x[3]);
00111
00114 static float DistanceToPlane(float x[3], float n[3], float p0[3]);
00115
00117
00122 static int IntersectWithLine(float p1[3], float p2[3], float n[3],
00123 float p0[3], float& t, float x[3]);
00125
00126
00127 protected:
00128 vtkPlane();
00129 ~vtkPlane() {};
00130
00131 float Normal[3];
00132 float Origin[3];
00133
00134 private:
00135 vtkPlane(const vtkPlane&);
00136 void operator=(const vtkPlane&);
00137 };
00138
00139 inline float vtkPlane::Evaluate(float normal[3], float origin[3], float x[3])
00140 {
00141 return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
00142 normal[2]*(x[2]-origin[2]);
00143 }
00144 inline float vtkPlane::Evaluate(double normal[3], double origin[3],double x[3])
00145 {
00146 return static_cast<float> (normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) +
00147 normal[2]*(x[2]-origin[2]));
00148 }
00149
00150 inline float vtkPlane::DistanceToPlane(float x[3], float n[3], float p0[3])
00151 {
00152 #define vtkPlaneAbs(x) ((x)<0?-(x):(x))
00153 return ((float) vtkPlaneAbs(n[0]*(x[0]-p0[0]) + n[1]*(x[1]-p0[1]) +
00154 n[2]*(x[2]-p0[2])));
00155 }
00156
00157 #endif
00158
00159