Go to the documentation of this file.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 TEST_FCL_UTILITY_H
00038 #define TEST_FCL_UTILITY_H
00039
00040 #include "fcl/math/transform.h"
00041 #include "fcl/collision_data.h"
00042 #include "fcl/collision_object.h"
00043
00044 #ifdef _WIN32
00045 #define NOMINMAX // required to avoid compilation errors with Visual Studio 2010
00046 #include <windows.h>
00047 #else
00048 #include <sys/time.h>
00049 #endif
00050
00051
00052 namespace fcl
00053 {
00054
00055 class Timer
00056 {
00057 public:
00058 Timer();
00059 ~Timer();
00060
00061 void start();
00062 void stop();
00063 double getElapsedTime();
00064 double getElapsedTimeInSec();
00065 double getElapsedTimeInMilliSec();
00066 double getElapsedTimeInMicroSec();
00067
00068 private:
00069 double startTimeInMicroSec;
00070 double endTimeInMicroSec;
00071 int stopped;
00072 #ifdef _WIN32
00073 LARGE_INTEGER frequency;
00074 LARGE_INTEGER startCount;
00075 LARGE_INTEGER endCount;
00076 #else
00077 timeval startCount;
00078 timeval endCount;
00079 #endif
00080 };
00081
00082
00084 void loadOBJFile(const char* filename, std::vector<Vec3f>& points, std::vector<Triangle>& triangles);
00085
00088 void generateRandomTransform(FCL_REAL extents[6], Transform3f& transform);
00089
00091 void generateRandomTransforms(FCL_REAL extents[6], std::vector<Transform3f>& transforms, std::size_t n);
00092
00094 void generateRandomTransforms(FCL_REAL extents[6], FCL_REAL delta_trans[3], FCL_REAL delta_rot, std::vector<Transform3f>& transforms, std::vector<Transform3f>& transforms2, std::size_t n);
00095
00097 void generateRandomTransforms_ccd(FCL_REAL extents[6], std::vector<Transform3f>& transforms, std::vector<Transform3f>& transforms2, FCL_REAL delta_trans[3], FCL_REAL delta_rot, std::size_t n,
00098 const std::vector<Vec3f>& vertices1, const std::vector<Triangle>& triangles1,
00099 const std::vector<Vec3f>& vertices2, const std::vector<Triangle>& triangles2);
00100
00101
00103 struct DistanceRes
00104 {
00105 double distance;
00106 Vec3f p1;
00107 Vec3f p2;
00108 };
00109
00111 struct CollisionData
00112 {
00113 CollisionData()
00114 {
00115 done = false;
00116 }
00117
00119 CollisionRequest request;
00120
00122 CollisionResult result;
00123
00125 bool done;
00126 };
00127
00128
00130 struct DistanceData
00131 {
00132 DistanceData()
00133 {
00134 done = false;
00135 }
00136
00138 DistanceRequest request;
00139
00141 DistanceResult result;
00142
00144 bool done;
00145
00146 };
00147
00148
00149
00151 bool defaultCollisionFunction(CollisionObject* o1, CollisionObject* o2, void* cdata);
00152
00154 bool defaultDistanceFunction(CollisionObject* o1, CollisionObject* o2, void* cdata, FCL_REAL& dist);
00155
00156
00157 }
00158
00159 #endif