Unverified Commit a089b172 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #241 from jcarpent/devel

Bug fixes
parents a8a119ed 8471b409
Pipeline #16030 passed with stage
in 23 minutes and 8 seconds
...@@ -13,3 +13,4 @@ dependencies: ...@@ -13,3 +13,4 @@ dependencies:
- doxygen - doxygen
- lxml - lxml
- pylatexenc - pylatexenc
- qhull
...@@ -40,7 +40,7 @@ jobs: ...@@ -40,7 +40,7 @@ jobs:
mkdir build mkdir build
cd build cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON -DHPP_FCL_HAS_QHULL=ON
make -j2 make -j2
make build_tests make build_tests
export CTEST_OUTPUT_ON_FAILURE=1 export CTEST_OUTPUT_ON_FAILURE=1
......
...@@ -55,6 +55,7 @@ jobs: ...@@ -55,6 +55,7 @@ jobs:
-DGENERATE_PYTHON_STUBS=OFF ^ -DGENERATE_PYTHON_STUBS=OFF ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^ -DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^ -DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DHPP_FCL_HAS_QHULL=ON ^
-DBUILD_PYTHON_INTERFACE=ON ^ -DBUILD_PYTHON_INTERFACE=ON ^
.. ..
......
...@@ -54,6 +54,7 @@ jobs: ...@@ -54,6 +54,7 @@ jobs:
-DGENERATE_PYTHON_STUBS=OFF ^ -DGENERATE_PYTHON_STUBS=OFF ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^ -DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^ -DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DHPP_FCL_HAS_QHULL=ON ^
-DBUILD_PYTHON_INTERFACE=ON ^ -DBUILD_PYTHON_INTERFACE=ON ^
.. ..
......
...@@ -120,10 +120,8 @@ endif() ...@@ -120,10 +120,8 @@ endif()
option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE) option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE)
if(HPP_FCL_HAS_QHULL) if(HPP_FCL_HAS_QHULL)
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD EQUAL 98) CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
message(FATAL_ERROR "Cannot use qhull library with C++ < 11.\nYou may add -DCMAKE_CXX_STANDARD=11") ADD_PROJECT_DEPENDENCY(Qhull COMPONENTS qhull_r qhullcpp PKG_CONFIG_REQUIRES "qhull_r, qhuppcpp")
endif()
find_package(Qhull COMPONENTS qhull_r qhullcpp)
if(Qhull_FOUND) if(Qhull_FOUND)
set(HPP_FCL_USE_SYSTEM_QHULL TRUE) set(HPP_FCL_USE_SYSTEM_QHULL TRUE)
else() else()
......
...@@ -119,10 +119,7 @@ public: ...@@ -119,10 +119,7 @@ public:
virtual bool BVDisjoints(int b1, int b2, FCL_REAL& sqrDistLowerBound) const = 0; virtual bool BVDisjoints(int b1, int b2, FCL_REAL& sqrDistLowerBound) const = 0;
/// @brief Leaf test between node b1 and b2, if they are both leafs /// @brief Leaf test between node b1 and b2, if they are both leafs
virtual void leafCollides(int /*b1*/, int /*b2*/, FCL_REAL& /*sqrDistLowerBound*/) const virtual void leafCollides(int /*b1*/, int /*b2*/, FCL_REAL& /*sqrDistLowerBound*/) const = 0;
{
throw std::runtime_error ("Not implemented");
}
/// @brief Check whether the traversal can stop /// @brief Check whether the traversal can stop
bool canStop() const { return this->request.isSatisfied(*(this->result)); } bool canStop() const { return this->request.isSatisfied(*(this->result)); }
......
...@@ -77,12 +77,20 @@ typedef std::vector<Triangle> Triangles; ...@@ -77,12 +77,20 @@ typedef std::vector<Triangle> Triangles;
struct BVHModelBaseWrapper struct BVHModelBaseWrapper
{ {
static Vec3f vertices (const BVHModelBase& bvh, int i) typedef Eigen::Matrix<double,Eigen::Dynamic,3> MatrixX3;
typedef Eigen::Map<MatrixX3> MapMatrixX3;
static Vec3f & vertice (BVHModelBase & bvh, int i)
{ {
if (i >= bvh.num_vertices) throw std::out_of_range("index is out of range"); if (i >= bvh.num_vertices) throw std::out_of_range("index is out of range");
return bvh.vertices[i]; return bvh.vertices[i];
} }
static MapMatrixX3 vertices(BVHModelBase & bvh)
{
return MapMatrixX3(bvh.vertices[0].data(),bvh.num_vertices,3);
}
static Triangle tri_indices (const BVHModelBase& bvh, int i) static Triangle tri_indices (const BVHModelBase& bvh, int i)
{ {
if (i >= bvh.num_tris) throw std::out_of_range("index is out of range"); if (i >= bvh.num_tris) throw std::out_of_range("index is out of range");
...@@ -461,8 +469,12 @@ void exposeCollisionGeometries () ...@@ -461,8 +469,12 @@ void exposeCollisionGeometries ()
class_ <BVHModelBase, bases<CollisionGeometry>, BVHModelPtr_t, noncopyable> class_ <BVHModelBase, bases<CollisionGeometry>, BVHModelPtr_t, noncopyable>
("BVHModelBase", no_init) ("BVHModelBase", no_init)
.def ("vertice", &BVHModelBaseWrapper::vertice,
bp::args("self","index"),"Retrieve the vertex given by its index.",
bp::return_internal_reference<>())
.def ("vertices", &BVHModelBaseWrapper::vertices, .def ("vertices", &BVHModelBaseWrapper::vertices,
bp::args("self","index"),"Retrieve the vertex given by its index.") bp::args("self"),"Retrieve the vertex given by its index.",
bp::with_custodian_and_ward_postcall<0,1>())
.def ("tri_indices", &BVHModelBaseWrapper::tri_indices, .def ("tri_indices", &BVHModelBaseWrapper::tri_indices,
bp::args("self","index"),"Retrieve the triangle given by its index.") bp::args("self","index"),"Retrieve the triangle given by its index.")
.def_readonly ("num_vertices", &BVHModelBase::num_vertices) .def_readonly ("num_vertices", &BVHModelBase::num_vertices)
......
...@@ -139,7 +139,7 @@ void BVHModelBase::buildConvexRepresentation(bool share_memory) ...@@ -139,7 +139,7 @@ void BVHModelBase::buildConvexRepresentation(bool share_memory)
polygons = new Triangle[num_tris]; polygons = new Triangle[num_tris];
memcpy(polygons, tri_indices, sizeof(Triangle) * (size_t)num_tris); memcpy(polygons, tri_indices, sizeof(Triangle) * (size_t)num_tris);
} }
convex.reset(new Convex<Triangle>(!share_memory, points, num_vertices, polygons, num_vertices)); convex.reset(new Convex<Triangle>(!share_memory, points, num_vertices, polygons, num_tris));
} }
} }
......
Markdown is supported
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