Commit b2f601b7 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[Test] Move utilities in static library.

parent bf4e58dd
......@@ -14,42 +14,44 @@ macro(add_fcl_test test_name)
hpp-fcl
${Boost_LIBRARIES}
)
target_link_libraries(${test_name} utility)
add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
endmacro(add_fcl_test)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
add_library(utility STATIC utility.cpp)
add_fcl_test(math math.cpp)
add_fcl_test(collision collision.cpp utility.cpp)
add_fcl_test(distance distance.cpp utility.cpp)
add_fcl_test(distance_lower_bound distance_lower_bound.cpp utility.cpp)
add_fcl_test(geometric_shapes geometric_shapes.cpp utility.cpp)
#add_fcl_test(broadphase broadphase.cpp utility.cpp)
#add_fcl_test(shape_mesh_consistency shape_mesh_consistency.cpp utility.cpp)
add_fcl_test(frontlist frontlist.cpp utility.cpp)
#add_fcl_test(math math.cpp utility.cpp)
add_fcl_test(collision collision.cpp)
add_fcl_test(distance distance.cpp)
add_fcl_test(distance_lower_bound distance_lower_bound.cpp)
add_fcl_test(geometric_shapes geometric_shapes.cpp)
#add_fcl_test(broadphase broadphase.cpp)
#add_fcl_test(shape_mesh_consistency shape_mesh_consistency.cpp)
add_fcl_test(frontlist frontlist.cpp)
#add_fcl_test(math math.cpp)
# add_fcl_test(sphere_capsule sphere_capsule.cpp)
add_fcl_test(capsule_capsule capsule_capsule.cpp utility.cpp)
add_fcl_test(box_box_distance box_box_distance.cpp utility.cpp)
add_fcl_test(capsule_capsule capsule_capsule.cpp)
add_fcl_test(box_box_distance box_box_distance.cpp)
add_fcl_test(simple simple.cpp)
add_fcl_test(capsule_box_1 capsule_box_1.cpp utility.cpp)
add_fcl_test(capsule_box_2 capsule_box_2.cpp utility.cpp)
add_fcl_test(capsule_box_1 capsule_box_1.cpp)
add_fcl_test(capsule_box_2 capsule_box_2.cpp)
add_fcl_test(obb obb.cpp)
add_fcl_test(bvh_models bvh_models.cpp utility.cpp)
add_fcl_test(bvh_models bvh_models.cpp)
add_fcl_test(profiling profiling.cpp utility.cpp)
add_fcl_test(profiling profiling.cpp)
PKG_CONFIG_USE_DEPENDENCY(profiling assimp)
add_fcl_test(gjk gjk.cpp)
if(HPP_FCL_HAVE_OCTOMAP)
add_fcl_test(octree octree.cpp utility.cpp)
add_fcl_test(octree octree.cpp)
endif(HPP_FCL_HAVE_OCTOMAP)
## Benchmark
add_executable(test-benchmark benchmark.cpp utility.cpp)
target_link_libraries(test-benchmark hpp-fcl ${Boost_LIBRARIES})
add_executable(test-benchmark benchmark.cpp)
target_link_libraries(test-benchmark hpp-fcl ${Boost_LIBRARIES} utility)
......@@ -56,28 +56,6 @@ FCL_REAL tol_gjk = 0.01;
GJKSolver solver1;
GJKSolver solver2;
Eigen::IOFormat fmt(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "", "");
Eigen::IOFormat pyfmt(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "[", "]");
typedef Eigen::AngleAxis<FCL_REAL> AngleAxis;
//static const Vec3f UnitX (1, 0, 0);
//static const Vec3f UnitY (0, 1, 0);
static const Vec3f UnitZ (0, 0, 1);
namespace hpp {
namespace fcl {
std::ostream& operator<< (std::ostream& os, const Transform3f& tf)
{
return os << "[ " <<
tf.getTranslation().format(fmt)
<< ", "
<< tf.getQuatRotation().coeffs().format(fmt)
<< " ]" ;
}
}
}
#define BOOST_CHECK_FALSE(p) BOOST_CHECK(!(p))
template <typename S1, typename S2>
......
......@@ -10,7 +10,6 @@ namespace hpp
namespace fcl
{
Timer::Timer()
{
#ifdef _WIN32
......@@ -94,6 +93,13 @@ double Timer::getElapsedTime()
}
const Eigen::IOFormat vfmt = Eigen::IOFormat (Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "", "");
const Eigen::IOFormat pyfmt = Eigen::IOFormat (Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "[", "]");
const Vec3f UnitX = Vec3f(1, 0, 0);
const Vec3f UnitY = Vec3f(0, 1, 0);
const Vec3f UnitZ = Vec3f(0, 0, 1);
FCL_REAL rand_interval(FCL_REAL rmin, FCL_REAL rmax)
{
FCL_REAL t = rand() / ((FCL_REAL)RAND_MAX + 1);
......@@ -473,6 +479,15 @@ Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z)
return q;
}
std::ostream& operator<< (std::ostream& os, const Transform3f& tf)
{
return os << "[ " <<
tf.getTranslation().format(vfmt)
<< ", "
<< tf.getQuatRotation().coeffs().format(vfmt)
<< " ]" ;
}
}
} // namespace hpp
......@@ -92,6 +92,12 @@ private:
#endif
};
extern const Eigen::IOFormat vfmt;
extern const Eigen::IOFormat pyfmt;
typedef Eigen::AngleAxis<FCL_REAL> AngleAxis;
extern const Vec3f UnitX;
extern const Vec3f UnitY;
extern const Vec3f UnitZ;
/// @brief Load an obj mesh file
void loadOBJFile(const char* filename, std::vector<Vec3f>& points, std::vector<Triangle>& triangles);
......@@ -176,6 +182,8 @@ std::string getGJKSolverName(GJKSolverType solver_type);
Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z);
std::ostream& operator<< (std::ostream& os, const Transform3f& tf);
}
} // namespace hpp
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment