grasp
boundingBox.h
1 /* Copyright: (C) 2014 iCub Facility - Istituto Italiano di Tecnologia
2  * Authors: Ilaria Gori
3  * email: ilaria.gori@iit.it
4  * Permission is granted to copy, distribute, and/or modify this program
5  * under the terms of the GNU General Public License, version 2 or any
6  * later version published by the Free Software Foundation.
7  *
8  * A copy of the license can be found in the file LICENSE located in the
9  * root directory.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details
15 */
16 
30 #ifndef __BOUNDING_BOX_H__
31 #define __BOUNDING_BOX_H__
32 
33 #include <string>
34 #include <algorithm>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <iostream>
38 #include <fstream>
39 #include <sstream>
40 #include <vector>
41 #include <cmath>
42 #include <yarp/sig/Vector.h>
43 #include <yarp/math/Math.h>
44 #include <boost/thread/thread.hpp>
45 #include "pcl/common/common_headers.h"
46 #include <pcl/console/parse.h>
47 #include <pcl/point_types.h>
48 #include <pcl/surface/convex_hull.h>
49 #include <pcl/visualization/pcl_visualizer.h>
50 #include <iCub/data3D/Box3D.h>
51 
52 namespace iCub
53 {
54 namespace data3D
55 {
62 {
63  iCub::data3D::Box3D boundingBox;
64  yarp::sig::Vector findIndexes(const yarp::sig::Matrix &corner_i);
65  yarp::sig::Matrix convertCorners();
66 
67  public:
68 
73 
78  BoundingBox(const iCub::data3D::Box3D &boundingBox);
79 
84  iCub::data3D::Box3D getBoundingBox();
85 
90  void setBoundingBox(const iCub::data3D::Box3D &boundingBox);
91 
96  std::vector<iCub::data3D::PointXYZ> getCorners();
97 
102  void setCorners(const std::vector<iCub::data3D::PointXYZ> &corners);
103 
108  yarp::sig::Matrix getOrientation();
109 
114  void setOrientation(const yarp::sig::Matrix &orientation);
115 
122  yarp::sig::Vector getDim();
123 
130  void getAxis(yarp::sig::Vector &x, yarp::sig::Vector &y, yarp::sig::Vector &z);
131 
136  yarp::sig::Vector getCenter();
137 
143  void drawBoundingBox(boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer, int viewport=0);
144 };
145 }
146 }
147 #endif
148 
yarp::sig::Vector getCenter()
Return the center of the bounding box.
The Definition of the BoundingBox class.
Definition: boundingBox.h:61
BoundingBox()
Default Constructor.
Definition: boundingBox.h:72
yarp::sig::Matrix getOrientation()
Return the orientation of the Box3D structure.
Definition: boundingBox.cpp:59
void setCorners(const std::vector< iCub::data3D::PointXYZ > &corners)
Set the corners of the bounding box.
Definition: boundingBox.cpp:53
iCub::data3D::Box3D getBoundingBox()
Return the Box3D structure underline the bounding box.
Definition: boundingBox.cpp:34
void setOrientation(const yarp::sig::Matrix &orientation)
Modify the orientation of the bounding box.
Definition: boundingBox.cpp:65
yarp::sig::Vector getDim()
Return the dimension of the principal axes, in the same order of the getAxis method.
void setBoundingBox(const iCub::data3D::Box3D &boundingBox)
Set a Box3D inside the BoundingBox wrapper.
Definition: boundingBox.cpp:40
void getAxis(yarp::sig::Vector &x, yarp::sig::Vector &y, yarp::sig::Vector &z)
Provide the principal axes of the bounding box.
void drawBoundingBox(boost::shared_ptr< pcl::visualization::PCLVisualizer > viewer, int viewport=0)
Draw a 3D box in a PCLVisualizer window.
std::vector< iCub::data3D::PointXYZ > getCorners()
Return the corners of the Box3D structure.
Definition: boundingBox.cpp:47