Commit e628dc6c authored by Lucile Remigy's avatar Lucile Remigy
Browse files

Merge branch 'refactoring' into devel

parents d2b8fc79 e34f7250
......@@ -3,19 +3,37 @@ language: cpp
env:
global:
- CTEST_PARALLEL_LEVEL=4
matrix:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
- CTEST_OUTPUT_ON_FAILURE=1
- CXX_FLAGS_DEBUG="-O1"
matrix:
include:
- dist: trusty
compiler: gcc
- dist: xenial
compiler: gcc
- dist: xenial
- name: "Trusty - Debug - g++"
env: BUILD_TYPE=Debug
dist: trusty
compiler: g++
- name: "Xenial - Debug - g++"
env: BUILD_TYPE=Debug
dist: xenial
compiler: g++
- name: "Xenial - Release - g++"
env: BUILD_TYPE=Release
dist: xenial
compiler: g++
- name: "Xenial - Debug - clang"
env: BUILD_TYPE=Debug
dist: xenial
compiler: clang
- os: osx
- name: "Bionic - Debug - g++"
env: BUILD_TYPE=Debug
dist: xenial
compiler: g++
- name: "OSX - Debug - clang"
env: BUILD_TYPE=Debug
os: osx
compiler: clang
install:
......@@ -29,13 +47,13 @@ script:
- cd build
# Configure
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS=-w ..
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS=-w -DCMAKE_CXX_FLAGS_DEBUG=${CXX_FLAGS_DEBUG} ..
# Build
- make -j4
# Run unit tests
- travis_wait 30 make test || travis_wait 30 ctest -VV
- travis_wait 30 ctest
# Make sure we can install and uninstall with no issues
- sudo make -j4 install
......
Subproject commit 441552634e4c427956be7b2834a6bbf894b24f0c
Subproject commit b58bd669f6567662eefb8a410e8e40aeba4f1060
......@@ -42,6 +42,7 @@
#include <hpp/fcl/data_types.h>
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -54,13 +55,22 @@ namespace fcl
/// Return value is the number of contacts generated between the two objects.
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const CollisionRequest& request,
CollisionResult& result);
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
const CollisionRequest& request,
CollisionResult& result);
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const CollisionRequest& request, CollisionResult& result);
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const CollisionRequest& request, CollisionResult& result);
}
} // namespace hpp
......
......@@ -42,6 +42,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -49,7 +50,7 @@ namespace fcl
{
/// @brief collision matrix stores the functions for collision between different types of objects and provides a uniform call interface
template<typename GJKSolver>
struct CollisionFunctionMatrix
{
/// @brief the uniform call interface for collision: for collision, we need know
......
......@@ -40,6 +40,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -50,12 +51,19 @@ namespace fcl
/// Return value is the minimum distance generated between the two objects.
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const DistanceRequest& request, DistanceResult& result);
}
} // namespace hpp
......
......@@ -40,6 +40,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -47,7 +48,6 @@ namespace fcl
{
/// @brief distance matrix stores the functions for distance between different types of objects and provides a uniform call interface
template<typename GJKSolver>
struct DistanceFunctionMatrix
{
/// @brief the uniform call interface for distance: for distance, we need know
......
......@@ -41,6 +41,9 @@
#include <hpp/fcl/BVH/BVH_model.h>
class aiScene;
namespace Assimp {
class Importer;
}
namespace hpp
{
......@@ -62,7 +65,8 @@ struct Loader {
void load (const std::string& resource_path);
aiScene* scene;
Assimp::Importer* importer;
aiScene const* scene;
};
/**
......
......@@ -764,8 +764,14 @@ int BVHModel<BV>::refitTree(bool bottomup)
template<typename BV>
int BVHModel<BV>::refitTree_bottomup()
{
// TODO the recomputation of the BV is done manually, without using
// bv_fitter. The manual BV recomputation seems bugged. Using bv_fitter
// seems to correct the bug.
//bv_fitter->set(vertices, tri_indices, getModelType());
int res = recursiveRefitTree_bottomup(0);
//bv_fitter->clear();
return res;
}
......@@ -812,6 +818,9 @@ int BVHModel<BV>::recursiveRefitTree_bottomup(int bv_id)
}
else
{
//TODO use bv_fitter to build BV. See comment in refitTree_bottomup
//unsigned int* cur_primitive_indices = primitive_indices + bvnode->first_primitive;
//bv = bv_fitter->fit(cur_primitive_indices, bvnode->num_primitives);
Vec3f v[3];
for(int i = 0; i < 3; ++i)
{
......@@ -834,6 +843,9 @@ int BVHModel<BV>::recursiveRefitTree_bottomup(int bv_id)
recursiveRefitTree_bottomup(bvnode->leftChild());
recursiveRefitTree_bottomup(bvnode->rightChild());
bvnode->bv = bvs[bvnode->leftChild()].bv + bvs[bvnode->rightChild()].bv;
//TODO use bv_fitter to build BV. See comment in refitTree_bottomup
//unsigned int* cur_primitive_indices = primitive_indices + bvnode->first_primitive;
//bvnode->bv = bv_fitter->fit(cur_primitive_indices, bvnode->num_primitives);
}
return BVH_OK;
......
......@@ -47,21 +47,18 @@ namespace hpp
namespace fcl
{
template<typename GJKSolver>
CollisionFunctionMatrix<GJKSolver>& getCollisionFunctionLookTable()
CollisionFunctionMatrix& getCollisionFunctionLookTable()
{
static CollisionFunctionMatrix<GJKSolver> table;
static CollisionFunctionMatrix table;
return table;
}
template<typename GJKSolver>
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const CollisionRequest& request,
CollisionResult& result)
{
return collide(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(),
nsolver, request, result);
return collide(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver, request, result);
}
// reorder collision results in the order the call has been made.
......@@ -81,7 +78,6 @@ void invertResults(CollisionResult& result)
}
}
template<typename GJKSolver>
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
......@@ -92,7 +88,7 @@ std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
if(!nsolver_)
nsolver = new GJKSolver();
const CollisionFunctionMatrix<GJKSolver>& looktable = getCollisionFunctionLookTable<GJKSolver>();
const CollisionFunctionMatrix& looktable = getCollisionFunctionLookTable();
result.distance_lower_bound = -1;
std::size_t res;
if(request.num_max_contacts == 0)
......@@ -146,7 +142,7 @@ std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
case GST_INDEP:
{
GJKSolver solver;
return collide<GJKSolver>(o1, o2, &solver, request, result);
return collide(o1, o2, &solver, request, result);
}
default:
return -1; // error
......@@ -162,7 +158,7 @@ std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
case GST_INDEP:
{
GJKSolver solver;
return collide<GJKSolver>(o1, tf1, o2, tf2, &solver, request, result);
return collide(o1, tf1, o2, tf2, &solver, request, result);
}
default:
std::cerr << "Warning! Invalid GJK solver" << std::endl;
......
This diff is collapsed.
......@@ -46,22 +46,19 @@ namespace hpp
namespace fcl
{
template<typename GJKSolver>
DistanceFunctionMatrix<GJKSolver>& getDistanceFunctionLookTable()
DistanceFunctionMatrix& getDistanceFunctionLookTable()
{
static DistanceFunctionMatrix<GJKSolver> table;
static DistanceFunctionMatrix table;
return table;
}
template<typename GJKSolver>
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const GJKSolver* nsolver,
const DistanceRequest& request, DistanceResult& result)
{
return distance<GJKSolver>(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver,
return distance(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver,
request, result);
}
template<typename GJKSolver>
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
......@@ -71,7 +68,7 @@ FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
if(!nsolver_)
nsolver = new GJKSolver();
const DistanceFunctionMatrix<GJKSolver>& looktable = getDistanceFunctionLookTable<GJKSolver>();
const DistanceFunctionMatrix& looktable = getDistanceFunctionLookTable();
OBJECT_TYPE object_type1 = o1->getObjectType();
NODE_TYPE node_type1 = o1->getNodeType();
......@@ -126,7 +123,7 @@ FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const Di
case GST_INDEP:
{
GJKSolver solver;
return distance<GJKSolver>(o1, o2, &solver, request, result);
return distance(o1, o2, &solver, request, result);
}
default:
return -1; // error
......@@ -142,7 +139,7 @@ FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
case GST_INDEP:
{
GJKSolver solver;
return distance<GJKSolver>(o1, tf1, o2, tf2, &solver, request, result);
return distance(o1, tf1, o2, tf2, &solver, request, result);
}
default:
return -1;
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Sphere, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Sphere>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Sphere, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Sphere, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -26,7 +26,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest& request,
......@@ -321,7 +321,7 @@ namespace fcl {
}
template <>
std::size_t ShapeShapeCollide <Capsule, Capsule, GJKSolver>
std::size_t ShapeShapeCollide <Capsule, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const CollisionRequest& request,
......@@ -331,7 +331,7 @@ namespace fcl {
DistanceResult distanceResult;
DistanceRequest distanceRequest (request.enable_contact);
FCL_REAL distance = ShapeShapeDistance <Capsule, Capsule, GJKSolver>
FCL_REAL distance = ShapeShapeDistance <Capsule, Capsule>
(o1, tf1, o2, tf2, unused, distanceRequest, distanceResult);
if (distance <= 0) {
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cone, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Cone, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Cone, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Cone>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cone, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Cone, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Cone, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Cone>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cylinder, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Cylinder, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Cylinder, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Cylinder>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
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