VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkClosedSurfacePointPlacer.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00027 #ifndef __vtkClosedSurfacePointPlacer_h 00028 #define __vtkClosedSurfacePointPlacer_h 00029 00030 #include "vtkInteractionWidgetsModule.h" // For export macro 00031 #include "vtkPointPlacer.h" 00032 00033 class vtkPlane; 00034 class vtkPlaneCollection; 00035 class vtkPlanes; 00036 class vtkRenderer; 00037 00038 class VTKINTERACTIONWIDGETS_EXPORT vtkClosedSurfacePointPlacer : public vtkPointPlacer 00039 { 00040 public: 00042 static vtkClosedSurfacePointPlacer *New(); 00043 00045 00046 vtkTypeMacro(vtkClosedSurfacePointPlacer,vtkPointPlacer); 00047 void PrintSelf(ostream& os, vtkIndent indent); 00049 00051 00057 void AddBoundingPlane(vtkPlane *plane); 00058 void RemoveBoundingPlane(vtkPlane *plane); 00059 void RemoveAllBoundingPlanes(); 00060 virtual void SetBoundingPlanes(vtkPlaneCollection*); 00061 vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection); 00062 void SetBoundingPlanes(vtkPlanes *planes); 00064 00066 00075 int ComputeWorldPosition( vtkRenderer *ren, 00076 double displayPos[2], 00077 double worldPos[3], 00078 double worldOrient[9] ); 00080 00082 00090 int ComputeWorldPosition( vtkRenderer *ren, 00091 double displayPos[2], 00092 double refWorldPos[2], 00093 double worldPos[3], 00094 double worldOrient[9] ); 00096 00099 int ValidateWorldPosition( double worldPos[3] ); 00100 00101 // Descrption: 00102 // Orientationation is ignored, and the above method 00103 // is called instead. 00104 int ValidateWorldPosition( double worldPos[3], 00105 double worldOrient[9]); 00106 00107 // Descrption: 00108 // The minimum distance the object should be from the faces of the object. 00109 // Must be greater than 0. Default is 0. 00110 vtkSetClampMacro( MinimumDistance, double, 0.0, VTK_DOUBLE_MAX ); 00111 vtkGetMacro( MinimumDistance, double ); 00112 00113 protected: 00114 vtkClosedSurfacePointPlacer(); 00115 ~vtkClosedSurfacePointPlacer(); 00116 00117 // A collection of planes used to bound the projection 00118 // plane 00119 vtkPlaneCollection *BoundingPlanes; 00120 00121 // Calculate the distance of a point from the Object. Negative 00122 // values imply that the point is outside. Positive values imply that it is 00123 // inside. The closest point to the object is returned in closestPt. 00124 static double GetDistanceFromObject( double pos[3], 00125 vtkPlaneCollection * pc, 00126 double closestPt[3]); 00127 00128 void BuildPlanes(); 00129 00130 double MinimumDistance; 00131 vtkPlaneCollection * InnerBoundingPlanes; 00132 00133 private: 00134 vtkClosedSurfacePointPlacer(const vtkClosedSurfacePointPlacer&); //Not implemented 00135 void operator=(const vtkClosedSurfacePointPlacer&); //Not implemented 00136 }; 00137 00138 #endif