Skip to content

Commit

Permalink
hpp-fcl -> coal
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Dec 6, 2024
1 parent e1c4653 commit 065d9d6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ set(PACKAGE_EXTRA_MACROS "set(HPP_GUI_QTVERSION ${HPP_GUI_QTVERSION})")
# Search for Boost.
add_project_dependency(Boost REQUIRED COMPONENTS thread regex system)

add_project_dependency("hpp-fcl")
add_project_dependency("coal")
add_project_dependency("hpp-manipulation-corba")
add_optional_dependency("remoteimu")

Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<depend>gepetto-viewer</depend>
<depend>gepetto-viewer-corba</depend>

<depend>hpp-fcl</depend>
<depend>coal</depend>
<depend>hpp-corbaserver</depend>
<depend>hpp-manipulation-corba</depend>
</package>
10 changes: 5 additions & 5 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ set(BUILD_HPP_WIDGETS_PLUGIN
set(BUILD_HPP_MANIPULATION_WIDGETS_PLUGIN
${hpp-manipulation-corba_FOUND}
CACHE BOOL "Build hppmanipulationwidgetsplugin")
set(BUILD_HPP_FCL_PLUGIN
${hpp-fcl_FOUND}
CACHE BOOL "Build hppfclplugin")
set(BUILD_COAL_PLUGIN
${coal_FOUND}
CACHE BOOL "Build coalplugin")

if(hpp-corbaserver_FOUND)
if(REMOTEIMU_FOUND AND BUILD_REMOTEIMU_PLUGIN)
Expand All @@ -47,6 +47,6 @@ if(hpp-corbaserver_FOUND)
endif(hpp-manipulation-corba_FOUND AND BUILD_HPP_MANIPULATION_WIDGETS_PLUGIN)
endif(hpp-corbaserver_FOUND)

if(BUILD_HPP_FCL_PLUGIN AND hpp-fcl_FOUND)
add_subdirectory(hppfcl)
if(BUILD_COAL_PLUGIN AND coal_FOUND)
add_subdirectory(coal)
endif()
4 changes: 2 additions & 2 deletions plugins/hppfcl/CMakeLists.txt → plugins/coal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ else()
endif()

gepetto_gui_plugin(
hppfclplugin
coalplugin
${QT4}
HEADERS_NO_MOC
node.hh
Expand All @@ -31,7 +31,7 @@ gepetto_gui_plugin(
plugin.cc
node.cc
LINK_DEPENDENCIES
hpp-fcl::hpp-fcl
coal::coal
gepetto-viewer-corba::gepetto-viewer-corba
Boost::thread
Boost::regex
Expand Down
6 changes: 3 additions & 3 deletions plugins/hppfcl/node.cc → plugins/coal/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// hpp-gui If not, see
// <http://www.gnu.org/licenses/>.

#include <hpp/fcl/mesh_loader/assimp.h>
#include <coal/mesh_loader/assimp.h>

#include <node.hh>

Expand All @@ -38,8 +38,8 @@ void BVHDisplay::setLevel(const int& level) {
level_ = level;
}

void BVHDisplay::init(hpp::fcl::SplitMethodType splitMethod) {
using namespace hpp::fcl;
void BVHDisplay::init(coal::SplitMethodType splitMethod) {
using namespace coal;

BVHPtr_t bvh(new BVH_t);
bvh->bv_splitter.reset(new BVSplitter<BoundingVolume>(splitMethod));
Expand Down
18 changes: 9 additions & 9 deletions plugins/hppfcl/node.hh → plugins/coal/node.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// hpp-gui If not, see
// <http://www.gnu.org/licenses/>.

#ifndef HPP_GUI_HPP_FCL_PLUGIN_NODE_HH
#define HPP_GUI_HPP_FCL_PLUGIN_NODE_HH
#ifndef HPP_GUI_COAL_PLUGIN_NODE_HH
#define HPP_GUI_COAL_PLUGIN_NODE_HH

#include <coal/BVH/BVH_model.h>
#include <coal/internal/BV_splitter.h>
#include <gepetto/viewer/node.h>
#include <hpp/fcl/BVH/BVH_model.h>
#include <hpp/fcl/internal/BV_splitter.h>

namespace hpp {
namespace gui {
Expand All @@ -39,12 +39,12 @@ class BVHDisplay : public Node {

void setColor(const osgVector4& color);

void init(hpp::fcl::SplitMethodType splitMethod);
void init(coal::SplitMethodType splitMethod);

private:
typedef hpp::fcl::OBB BoundingVolume;
typedef hpp::fcl::BVHModel<BoundingVolume> BVH_t;
typedef hpp::fcl::shared_ptr<BVH_t> BVHPtr_t;
typedef coal::OBB BoundingVolume;
typedef coal::BVHModel<BoundingVolume> BVH_t;
typedef coal::shared_ptr<BVH_t> BVHPtr_t;

void recursiveBuildTree(const BVH_t& bvh, int ibv, std::size_t level);

Expand All @@ -60,4 +60,4 @@ class BVHDisplay : public Node {
} // namespace gui
} // namespace hpp

#endif // HPP_GUI_HPP_FCL_PLUGIN_NODE_HH
#endif // HPP_GUI_COAL_PLUGIN_NODE_HH
19 changes: 9 additions & 10 deletions plugins/hppfcl/plugin.cc → plugins/coal/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,40 @@ namespace hpp {
namespace gui {
using gepetto::gui::MainWindow;

void HppFclPlugin::init() {
void CoalPlugin::init() {
MainWindow* main = MainWindow::instance();
main->registerSlot("addBV", this);

// TODO add a way to add an action to body tree items.
QToolBar* toolBar = MainWindow::instance()->addToolBar("hpp-fcl tools");
toolBar->setObjectName("hppfclplugin.toolbar");
QToolBar* toolBar = MainWindow::instance()->addToolBar("coal tools");
toolBar->setObjectName("coalplugin.toolbar");
QAction* openD = new QAction(QIcon::fromTheme("document-open"),
"Load a BVH model", toolBar);
toolBar->addAction(openD);
connect(openD, SIGNAL(triggered()), SLOT(openDialog()));
}

void HppFclPlugin::addBV(QString name, QString filename,
int splitMethod) const {
void CoalPlugin::addBV(QString name, QString filename, int splitMethod) const {
std::string _name(name.toStdString());

BVHDisplayPtr_t node(new BVHDisplay(filename.toStdString(), _name));
switch (splitMethod) {
default:
case 0:
node->init(hpp::fcl::SPLIT_METHOD_MEAN);
node->init(coal::SPLIT_METHOD_MEAN);
break;
case 1:
node->init(hpp::fcl::SPLIT_METHOD_MEDIAN);
node->init(coal::SPLIT_METHOD_MEDIAN);
break;
case 2:
node->init(hpp::fcl::SPLIT_METHOD_BV_CENTER);
node->init(coal::SPLIT_METHOD_BV_CENTER);
break;
}
MainWindow* main = MainWindow::instance();
main->osg()->insertNode(_name, node);
}

void HppFclPlugin::openDialog() const {
void CoalPlugin::openDialog() const {
bool ok;
QString filename = QFileDialog::getOpenFileName(NULL, "Select a mesh file");
if (filename.isNull()) return;
Expand Down Expand Up @@ -102,7 +101,7 @@ void HppFclPlugin::openDialog() const {
}

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Q_EXPORT_PLUGIN2(hppfclplugin, HppFclPlugin)
Q_EXPORT_PLUGIN2(coalplugin, CoalPlugin)
#endif

} // namespace gui
Expand Down
4 changes: 2 additions & 2 deletions plugins/hppfcl/plugin.hh → plugins/coal/plugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace hpp {
namespace gui {
class HppFclPlugin : public QObject, public gepetto::gui::PluginInterface {
class CoalPlugin : public QObject, public gepetto::gui::PluginInterface {
Q_OBJECT
Q_INTERFACES(gepetto::gui::PluginInterface)

Expand All @@ -30,7 +30,7 @@ class HppFclPlugin : public QObject, public gepetto::gui::PluginInterface {
#endif

public:
QString name() const { return QString("HppFclPlugin"); }
QString name() const { return QString("CoalPlugin"); }

public slots:
void addBV(QString name, QString filename, int splitMethod) const;
Expand Down

0 comments on commit 065d9d6

Please sign in to comment.