Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Common/vtkPlane.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPlane.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00034 #ifndef __vtkPlane_h 00035 #define __vtkPlane_h 00036 00037 #include "vtkImplicitFunction.h" 00038 00039 class VTK_COMMON_EXPORT vtkPlane : public vtkImplicitFunction 00040 { 00041 public: 00043 static vtkPlane *New(); 00044 00045 vtkTypeRevisionMacro(vtkPlane,vtkImplicitFunction); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00047 00049 00050 float EvaluateFunction(float x[3]); 00051 float EvaluateFunction(float x, float y, float z) 00052 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ; 00054 00056 void EvaluateGradient(float x[3], float g[3]); 00057 00059 00060 vtkSetVector3Macro(Normal,float); 00061 vtkGetVectorMacro(Normal,float,3); 00063 00065 00067 vtkSetVector3Macro(Origin,float); 00068 vtkGetVectorMacro(Origin,float,3); 00070 00073 void Push(float distance); 00074 00076 00079 static void ProjectPoint(float x[3], float origin[3], float normal[3], 00080 float xproj[3]); 00081 static void ProjectPoint(double x[3], double origin[3], double normal[3], 00082 double xproj[3]); 00084 00086 00089 static void GeneralizedProjectPoint(float x[3], float origin[3], 00090 float normal[3], float xproj[3]); 00092 00094 00095 static float Evaluate(float normal[3], float origin[3], float x[3]); 00096 static float Evaluate(double normal[3], double origin[3], double x[3]); 00098 00101 static float DistanceToPlane(float x[3], float n[3], float p0[3]); 00102 00104 00109 static int IntersectWithLine(float p1[3], float p2[3], float n[3], 00110 float p0[3], float& t, float x[3]); 00112 00113 00114 protected: 00115 vtkPlane(); 00116 ~vtkPlane() {}; 00117 00118 float Normal[3]; 00119 float Origin[3]; 00120 00121 private: 00122 vtkPlane(const vtkPlane&); // Not implemented. 00123 void operator=(const vtkPlane&); // Not implemented. 00124 }; 00125 00126 inline float vtkPlane::Evaluate(float normal[3], float origin[3], float x[3]) 00127 { 00128 return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) + 00129 normal[2]*(x[2]-origin[2]); 00130 } 00131 inline float vtkPlane::Evaluate(double normal[3], double origin[3],double x[3]) 00132 { 00133 return static_cast<float> (normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) + 00134 normal[2]*(x[2]-origin[2])); 00135 } 00136 00137 inline float vtkPlane::DistanceToPlane(float x[3], float n[3], float p0[3]) 00138 { 00139 #define vtkPlaneAbs(x) ((x)<0?-(x):(x)) 00140 return ((float) vtkPlaneAbs(n[0]*(x[0]-p0[0]) + n[1]*(x[1]-p0[1]) + 00141 n[2]*(x[2]-p0[2]))); 00142 } 00143 00144 #endif 00145 00146