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 "vtkPointPlacer.h" 00031 00032 class vtkPlane; 00033 class vtkPlaneCollection; 00034 class vtkPlanes; 00035 class vtkRenderer; 00036 00037 class VTK_WIDGETS_EXPORT vtkClosedSurfacePointPlacer : public vtkPointPlacer 00038 { 00039 public: 00041 static vtkClosedSurfacePointPlacer *New(); 00042 00044 00045 vtkTypeMacro(vtkClosedSurfacePointPlacer,vtkPointPlacer); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00048 00050 00056 void AddBoundingPlane(vtkPlane *plane); 00057 void RemoveBoundingPlane(vtkPlane *plane); 00058 void RemoveAllBoundingPlanes(); 00059 virtual void SetBoundingPlanes(vtkPlaneCollection*); 00060 vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection); 00061 void SetBoundingPlanes(vtkPlanes *planes); 00063 00065 00074 int ComputeWorldPosition( vtkRenderer *ren, 00075 double displayPos[2], 00076 double worldPos[3], 00077 double worldOrient[9] ); 00079 00081 00089 int ComputeWorldPosition( vtkRenderer *ren, 00090 double displayPos[2], 00091 double refWorldPos[2], 00092 double worldPos[3], 00093 double worldOrient[9] ); 00095 00098 int ValidateWorldPosition( double worldPos[3] ); 00099 00100 // Descrption: 00101 // Orientationation is ignored, and the above method 00102 // is called instead. 00103 int ValidateWorldPosition( double worldPos[3], 00104 double worldOrient[9]); 00105 00106 // Descrption: 00107 // The minimum distance the object should be from the faces of the object. 00108 // Must be greater than 0. Default is 0. 00109 vtkSetClampMacro( MinimumDistance, double, 0.0, VTK_DOUBLE_MAX ); 00110 vtkGetMacro( MinimumDistance, double ); 00111 00112 protected: 00113 vtkClosedSurfacePointPlacer(); 00114 ~vtkClosedSurfacePointPlacer(); 00115 00116 // A collection of planes used to bound the projection 00117 // plane 00118 vtkPlaneCollection *BoundingPlanes; 00119 00120 // Calculate the distance of a point from the Object. Negative 00121 // values imply that the point is outside. Positive values imply that it is 00122 // inside. The closest point to the object is returned in closestPt. 00123 static double GetDistanceFromObject( double pos[3], 00124 vtkPlaneCollection * pc, 00125 double closestPt[3]); 00126 00127 void BuildPlanes(); 00128 00129 double MinimumDistance; 00130 vtkPlaneCollection * InnerBoundingPlanes; 00131 00132 private: 00133 vtkClosedSurfacePointPlacer(const vtkClosedSurfacePointPlacer&); //Not implemented 00134 void operator=(const vtkClosedSurfacePointPlacer&); //Not implemented 00135 }; 00136 00137 #endif