/Users/craigcornelius/Projects/SPRING Mac Release 0.2/intersection.h

Go to the documentation of this file.
00001 // $Id: intersection.h,v 1.2 2006/05/24 16:52:41 sean Exp $ 
00002 // $Copyright: (c)2001 National Biocomputation Center, Stanford University $
00003 
00004 #ifndef Intersection_Header
00005 #define Intersection_Header
00006 
00007 #include "face.h"
00008 
00009 // Intersection test methods for triangles and AABBs by Tomas Moller
00010 // http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/
00011 // This code was described as Public Domain as of: 11/08/2005
00012 //
00013 // This class uses the singleton pattern, to prevent from intantiating this
00014 // class more than once. Chris: There's no need to have more than one instance.
00015 //
00016 // Author: Original Code: Tomas Akenine Moller
00017 // Author: C++ code: Chris (caschwan@gmx.net)
00018 //
00019 class Intersection {
00020 
00021 public:
00022 
00023     static int debug;
00024     static const char* rcsid;
00025     
00026     // To get the one and only instance of intersection.
00027     static Intersection* Instance();
00028 
00029     // the triangle-triangle intersection test
00030     bool intersects(Face *face0, Face *face1); 
00031     // the triangle-box (AABB) intersection test
00032     bool intersects(Face *face0, Point3D *min, Point3D *max); 
00033 
00034 private:  
00035 
00036     // private constructors, to disable instantiation more than once (singleton pattern)
00037     Intersection();
00038     ~Intersection();
00039 
00040         // intersection test functions by Tomas Moller
00041     int NoDivTriTriIsect(float V0[3], float V1[3], float V2[3],
00042                          float U0[3], float U1[3], float U2[3]);
00043     int triBoxOverlap(float boxcenter[3], float boxhalfsize[3], float triverts[3][3]);
00044 
00045         // helper functions for above intersection test functions
00046         int coplanar_tri_tri(float N[3], float V0[3], float V1[3], float V2[3],
00047                                      float U0[3], float U1[3], float U2[3]);
00048     int planeBoxOverlap(float normal[3], float vert[3], float maxbox[3]);
00049 
00050     // the one and only instance of Intersection
00051     static Intersection* pinstance;
00052 };
00053 
00054 #endif   // Intersection_Header_Header

Generated on Thu Aug 30 11:03:14 2007 for SPRING Mac by  doxygen 1.5.3