![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2005 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: ssExtentIntersector.h,v $ $Revision: 1.8 $ $State: Exp $ 00007 ******************************************************************************/ 00008 #ifndef ssExtentIntersector_H_ 00009 #define ssExtentIntersector_H_ 00010 00011 #include <vlutil/vlConfig.h> 00012 #include <vlutil/vlPrint.h> 00013 00014 #include "geometry/spatialSubdivision.h" 00015 #include "geometry/ssFunctor.h" 00016 00017 #include "geometry/chord.h" 00018 #include "geometry/point.h" 00019 #include "geometry/plane.h" 00020 #include "geometry/tdbextent.h" 00021 00023 // Note: Must use this macro to get around issues with VC 6.0 vs .Net/gcc. 00024 // 6.0 complains if you use the typename qualifier outside of a class definition, 00025 // but it is incorrect to not specify that the cell type is a type when using it 00026 // as a template parameter. 00028 #ifdef DtSPATIAL_SUB_CELL_TYPE 00029 #undef DtSPATIAL_SUB_CELL_TYPE 00030 #endif 00031 00032 #if _MSC_VER == 1200 // Visual Studio 6.0 00033 #define DtSPATIAL_SUB_CELL_TYPE DtSpatialSubdivision< T >::DtSpatialSubCellType 00034 #else 00035 #define DtSPATIAL_SUB_CELL_TYPE typename DtSpatialSubdivision< T >::DtSpatialSubCellType 00036 #endif 00037 00038 00039 00040 // 00041 // The DtSsExtentIntersector is *solely* responsible for intersecting a DtExtent and a 00042 // DtSpatialSubdivision together. 00043 // It does not know what to do with the intersection results, other than apply the 00044 // functor, nor does it rely on the specific contents of the spatial subdivision. 00045 // 00046 // This is one of the basic SS intersection classes provided by the toolkit. 00047 // 00048 template <typename T> 00049 class DtSsExtentIntersector 00050 { 00051 public: 00052 00053 // Constructor 00054 DtSsExtentIntersector(); 00055 00056 // Destructor 00057 virtual ~DtSsExtentIntersector(); 00058 00059 // Intersects the specified extent and spatial subdivision together. 00060 // @returns A boolean indicating whether or not the extent intersected the 00061 // spatial subdivision at all. 00062 virtual bool intersect(const DtExtent& extent, DtSpatialSubdivision< T >& spatialSubdivision) const; 00063 00064 // Intersects the specified extent and spatial subdivision together. Applies 00065 // the functor to the intersection results, in order, until the functor 00066 // is done processing (returns true). 00067 // 00068 // @returns A boolean indicating whether or not the extent intersected the 00069 // spatial subdivision or not. Has nothing to do with the functor's success 00070 // or failure in its own processing. 00071 // 00072 virtual bool intersect(const DtExtent& extent, 00073 DtSpatialSubdivision< T >& spatialSubdivision, 00074 DtSsFunctor<const DtExtent, DtSPATIAL_SUB_CELL_TYPE >& functor) const; 00075 00076 // This is provided to account for functors that take the template parameter 00077 // to the spatial subdivision as the first parameter (such as insertion functors) 00078 // rather than the intersection primitive, such as intersection functors 00079 // 00080 // @note All objects to intersect passed to this function @b must support the 00081 // expandExtent() function, so the intersector can determine the extent to use 00082 // for performing the intersection. 00083 virtual bool intersect(T& objectToIntersect, 00084 DtSpatialSubdivision< T >& spatialSubdivision, 00085 DtSsFunctor<T, DtSPATIAL_SUB_CELL_TYPE >& functor) const; 00086 00087 // Provides the minimum and maximum indices (X,Y,Z) of the cells comprising 00088 // the intersection of the extent and the spatial subdivision. 00089 // 00090 // @returns a boolean indicating whether or not there is an intersection. 00091 // @note If there is no intersection, the index values are undetermined. 00092 virtual bool getIndices(const DtExtent& extent, 00093 const DtSpatialSubdivision< T >& spatialSubdivision, int& minXIndex, 00094 int& minYIndex, int& minZIndex, int& maxXIndex, int& maxYIndex, int& maxZIndex) const; 00095 00096 private: 00097 // Copy constructor & Assignment operator - not implemented 00098 DtSsExtentIntersector(const DtSsExtentIntersector& orig); 00099 DtSsExtentIntersector& operator=(const DtSsExtentIntersector& orig); 00100 00101 private: 00102 00103 }; 00104 00105 // Include the inline code 00106 #define SSEXTENTINTERSECTOR_HEADER 00107 #include "geometry/ssExtentIntersector.inl" 00108 #undef SSEXTENTINTERSECTOR_HEADER 00109 00110 #ifdef DtSPATIAL_SUB_CELL_TYPE 00111 #undef DtSPATIAL_SUB_CELL_TYPE 00112 #endif 00113 00114 #endif 00115