mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
CloudViewer: refactoring + added CloudViewerCellPicker class to ignore picking backfaces (when backface culling is on)
This commit is contained in:
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "rtabmap/core/Transform.h"
|
||||
#include "rtabmap/core/StereoCameraModel.h"
|
||||
#include "rtabmap/gui/CloudViewerInteractorStyle.h"
|
||||
|
||||
#include <QVTKWidget.h>
|
||||
#include <pcl/pcl_base.h>
|
||||
@@ -48,9 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <set>
|
||||
|
||||
#include <pcl/visualization/mouse_event.h>
|
||||
#include <pcl/visualization/point_picking_event.h>
|
||||
#include <pcl/visualization/interactor_style.h>
|
||||
#include <pcl/PCLPointCloud2.h>
|
||||
|
||||
namespace pcl {
|
||||
@@ -67,32 +65,6 @@ class vtkOBBTree;
|
||||
namespace rtabmap {
|
||||
|
||||
class OctoMap;
|
||||
class CloudViewer;
|
||||
|
||||
class RTABMAPGUI_EXP CloudViewerInteractorStyle: public pcl::visualization::PCLVisualizerInteractorStyle
|
||||
{
|
||||
public:
|
||||
static CloudViewerInteractorStyle *New ();
|
||||
|
||||
public:
|
||||
CloudViewerInteractorStyle();
|
||||
virtual void Rotate();
|
||||
protected:
|
||||
virtual void OnMouseMove();
|
||||
virtual void OnLeftButtonDown();
|
||||
|
||||
protected:
|
||||
friend class CloudViewer;
|
||||
void setCloudViewer(CloudViewer * cloudViewer) {viewer_ = cloudViewer;}
|
||||
CloudViewer * viewer_;
|
||||
|
||||
private:
|
||||
unsigned int NumberOfClicks;
|
||||
int PreviousPosition[2];
|
||||
int ResetPixelDistance;
|
||||
float PreviousMeasure[3];
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointsHolder_;
|
||||
};
|
||||
|
||||
class RTABMAPGUI_EXP CloudViewer : public QVTKWidget
|
||||
{
|
||||
|
||||
40
guilib/include/rtabmap/gui/CloudViewerCellPicker.h
Normal file
40
guilib/include/rtabmap/gui/CloudViewerCellPicker.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* CloudViewerCellPicker.h
|
||||
*
|
||||
* Created on: Aug 21, 2018
|
||||
* Author: mathieu
|
||||
*/
|
||||
|
||||
#ifndef GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_
|
||||
#define GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_
|
||||
|
||||
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
|
||||
|
||||
#include <vtkCellPicker.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAPGUI_EXP CloudViewerCellPicker : public vtkCellPicker {
|
||||
public:
|
||||
public:
|
||||
static CloudViewerCellPicker *New ();
|
||||
CloudViewerCellPicker();
|
||||
virtual ~CloudViewerCellPicker();
|
||||
|
||||
protected:
|
||||
// overrided to ignore back faces
|
||||
virtual double IntersectActorWithLine(const double p1[3],
|
||||
const double p2[3],
|
||||
double t1, double t2,
|
||||
double tol,
|
||||
vtkProp3D *prop,
|
||||
vtkMapper *mapper);
|
||||
|
||||
private:
|
||||
vtkGenericCell * cell_; //used to accelerate picking
|
||||
vtkIdList * pointIds_; // used to accelerate picking
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
#endif /* GUILIB_SRC_CLOUDVIEWERCELLPICKER_H_ */
|
||||
49
guilib/include/rtabmap/gui/CloudViewerInteractorStyle.h
Normal file
49
guilib/include/rtabmap/gui/CloudViewerInteractorStyle.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* CloudViewerInteractorStyl.h
|
||||
*
|
||||
* Created on: Aug 21, 2018
|
||||
* Author: mathieu
|
||||
*/
|
||||
|
||||
#ifndef GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_
|
||||
#define GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_
|
||||
|
||||
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
|
||||
|
||||
#include <pcl/visualization/mouse_event.h>
|
||||
#include <pcl/visualization/point_picking_event.h>
|
||||
#include <pcl/visualization/interactor_style.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class CloudViewer;
|
||||
|
||||
class RTABMAPGUI_EXP CloudViewerInteractorStyle: public pcl::visualization::PCLVisualizerInteractorStyle
|
||||
{
|
||||
public:
|
||||
static CloudViewerInteractorStyle *New ();
|
||||
|
||||
public:
|
||||
CloudViewerInteractorStyle();
|
||||
virtual void Rotate();
|
||||
protected:
|
||||
virtual void OnMouseMove();
|
||||
virtual void OnLeftButtonDown();
|
||||
|
||||
protected:
|
||||
friend class CloudViewer;
|
||||
void setCloudViewer(CloudViewer * cloudViewer) {viewer_ = cloudViewer;}
|
||||
CloudViewer * viewer_;
|
||||
|
||||
private:
|
||||
unsigned int NumberOfClicks;
|
||||
int PreviousPosition[2];
|
||||
int ResetPixelDistance;
|
||||
float PreviousMeasure[3];
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointsHolder_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
#endif /* GUILIB_SRC_CLOUDVIEWERINTERACTORSTYLE_H_ */
|
||||
Reference in New Issue
Block a user