00001 #ifndef RAYCAST_MESH_H 00002 00003 #define RAYCAST_MESH_H 00004 00005 #include <stdint.h> 00006 00007 namespace VHACD 00008 { 00009 00010 // Very simple brute force raycast against a triangle mesh. Tests every triangle; no hierachy. 00011 // Does a deep copy, always does calculations with full double float precision 00012 class RaycastMesh 00013 { 00014 public: 00015 static RaycastMesh * createRaycastMesh(uint32_t vcount, // The number of vertices in the source triangle mesh 00016 const double *vertices, // The array of vertex positions in the format x1,y1,z1..x2,y2,z2.. etc. 00017 uint32_t tcount, // The number of triangles in the source triangle mesh 00018 const uint32_t *indices); // The triangle indices in the format of i1,i2,i3 ... i4,i5,i6, ... 00019 00020 static RaycastMesh * createRaycastMesh(uint32_t vcount, // The number of vertices in the source triangle mesh 00021 const float *vertices, // The array of vertex positions in the format x1,y1,z1..x2,y2,z2.. etc. 00022 uint32_t tcount, // The number of triangles in the source triangle mesh 00023 const uint32_t *indices); // The triangle indices in the format of i1,i2,i3 ... i4,i5,i6, ... 00024 00025 00026 virtual bool raycast(const double *from, // The starting point of the raycast 00027 const double *to, // The ending point of the raycast 00028 const double *closestToPoint, // The point to match the nearest hit location (can just be the 'from' location of no specific point) 00029 double *hitLocation, // The point where the ray hit nearest to the 'closestToPoint' location 00030 double *hitDistance) = 0; // The distance the ray traveled to the hit location 00031 00032 virtual void release(void) = 0; 00033 protected: 00034 virtual ~RaycastMesh(void) { }; 00035 }; 00036 00037 } // end of VHACD namespace 00038 00039 #endif