VR-Forces 4.0.4 Class Documentation
include/geometry/ssSphereIntersector.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2005 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: ssSphereIntersector.h,v $ $Revision: 1.2 $ $State: Exp $
00007 ******************************************************************************/
00008 #ifndef ssShpereIntersector_H_
00009 #define ssSphereIntersector_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/sphere.h"
00018 #include "geometry/point.h"
00019 
00021 // Note:  Must use this macro to get around issues with VC 6.0 vs .Net/gcc.
00022 // 6.0 complains if you use the typename qualifier outside of a class definition,
00023 // but it is incorrect to not specify that the cell type is a type when using it
00024 // as a template parameter.
00026 #ifdef DtSPATIAL_SUB_CELL_TYPE
00027 #undef DtSPATIAL_SUB_CELL_TYPE
00028 #endif
00029 
00030 #if _MSC_VER == 1200 // Visual Studio 6.0
00031 #define DtSPATIAL_SUB_CELL_TYPE DtSpatialSubdivision< T >::DtSpatialSubCellType 
00032 #else
00033 #define DtSPATIAL_SUB_CELL_TYPE typename DtSpatialSubdivision< T >::DtSpatialSubCellType 
00034 #endif
00035 
00036 
00037 
00038 //
00039 // The DtSsSphereIntersector is *solely* responsible for intersecting a DtSphere and a 
00040 // DtSpatialSubdivision together.  It does not know what to do with the intersection
00041 // results, nor does it rely on the specific contents of the spatial subdivision.
00042 //
00043 // This is one of the basic SS intersection classes provided by the toolkit.
00044 //
00045 template <typename T>
00046 class DtSsSphereIntersector
00047 {
00048 public:
00049 
00050    // Constructor
00051    DtSsSphereIntersector();
00052 
00053    // Destructor
00054    virtual ~DtSsSphereIntersector();
00055 
00056    // Intersects the specified chord and spatial subdivision together.
00057    // @returns A boolean indicating whether or not the chord intersected the
00058    // spatial subdivision at all.  
00059    // @note Technically, this returns true if the chord's @b extent intersects 
00060    // the spatial subdivision at all.  It does not do a true mathematical 
00061    // intersection of the chord and the SS.
00062    virtual bool intersect(const DtSphere& sphere, DtSpatialSubdivision< T >& spatialSubdivision) const;
00063 
00064    // Intersects the specified chord 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 chord 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    // @note Unlike the above intersection function, this function only returns 
00073    // true if the chord intersected the SS, not just the chord's extent.  And the
00074    // functor is applied to the cells in the SS in the order that the chord intersects
00075    // them.
00076    //
00077    virtual bool intersect(const DtSphere& sphere, 
00078       DtSpatialSubdivision< T >& spatialSubdivision,
00079       DtSsFunctor<const DtSphere, DtSPATIAL_SUB_CELL_TYPE >& functor) const;
00080 
00081 private:
00082    // Copy constructor & Assignment operator  - not implemented
00083    DtSsSphereIntersector(const DtSsSphereIntersector& orig);
00084    DtSsSphereIntersector& operator=(const DtSsSphereIntersector& orig);
00085 
00086 };
00087 
00088 #define SSSPHEREINTERSECTOR_HEADER
00089 #include "geometry/ssSphereIntersector.inl"
00090 #undef SSSPHEREINTERSECTOR_HEADER
00091 
00092 #ifdef DtSPATIAL_SUB_CELL_TYPE
00093 #undef DtSPATIAL_SUB_CELL_TYPE
00094 #endif
00095 
00096 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)