00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00037 #ifndef COLLISION_CHECKING_DISTANCE_PRIMITIVE_H
00038 #define COLLISION_CHECKING_DISTANCE_PRIMITIVE_H
00039
00040 #include "collision_checking/BVH_defs.h"
00041 #include "collision_checking/BVH_model.h"
00042 #include "collision_checking/BVH_front.h"
00043
00045 namespace collision_checking
00046 {
00047
00048 struct BVH_DistanceResult
00049 {
00051 int num_bv_tests;
00052
00054 int num_tri_tests;
00055
00057 BVH_REAL query_time_seconds;
00058
00060 BVH_REAL rel_err;
00061 BVH_REAL abs_err;
00062
00066 BVH_REAL distance;
00067 Vec3f p1, p2;
00068
00075 int qsize;
00076
00078 int last_tri_id1;
00079 int last_tri_id2;
00080
00081 BVH_DistanceResult();
00082
00083 ~BVH_DistanceResult();
00084
00086 void resetRecord()
00087 {
00088 num_bv_tests = 0;
00089 num_tri_tests = 0;
00090 }
00091 };
00092
00093
00095 template<typename BV>
00096 void distanceRecurse(BVNode<BV>* tree1, BVNode<BV>* tree2, int b1, int b2,
00097 Vec3f* vertices1, Vec3f* vertices2,
00098 Triangle* tri_indices1, Triangle* tri_indices2,
00099 BVH_DistanceResult* res, BVHFrontList* front_list = NULL)
00100 {
00101 std::cerr << "Bounding volume structure default can not support distance operation!" << std::endl;
00102 }
00103
00105 void distanceRecurse(BVNode<RSS>* tree1, BVNode<RSS>* tree2,
00106 const Vec3f R[3], const Vec3f& T,
00107 int b1, int b2,
00108 Vec3f* vertices1, Vec3f* vertices2,
00109 Triangle* tri_indices1, Triangle* tri_indices2,
00110 BVH_DistanceResult* res, BVHFrontList* front_list = NULL);
00111
00112
00114 void distanceQueueRecurse(BVNode<RSS>* tree1, BVNode<RSS>* tree2,
00115 const Vec3f R[3], const Vec3f& T,
00116 int b1, int b2,
00117 Vec3f* vertices1, Vec3f* vertices2,
00118 Triangle* tri_indices1, Triangle* tri_indices2,
00119 BVH_DistanceResult* res, BVHFrontList* front_list = NULL);
00120
00121 }
00122
00123
00124 #endif