Point Cloud Library (PCL)  1.7.2
region_3d.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef PCL_SEGMENTATION_REGION_3D_H_
39 #define PCL_SEGMENTATION_REGION_3D_H_
40 
41 #include <Eigen/Core>
42 #include <vector>
43 
44 namespace pcl
45 {
46  /** \brief Region3D represents summary statistics of a 3D collection of points.
47  * \author Alex Trevor
48  */
49  template <typename PointT>
50  class Region3D
51  {
52  public:
53  /** \brief Empty constructor for Region3D. */
54  Region3D () : centroid_ (Eigen::Vector3f::Zero ()), covariance_ (Eigen::Matrix3f::Identity ()), count_ (0)
55  {
56  }
57 
58  /** \brief Constructor for Region3D.
59  * \param[in] centroid The centroid of the region.
60  * \param[in] covariance The covariance of the region.
61  * \param[in] count The number of points in the region.
62  */
63  Region3D (Eigen::Vector3f& centroid, Eigen::Matrix3f& covariance, unsigned count)
64  : centroid_ (centroid), covariance_ (covariance), count_ (count)
65  {
66  }
67 
68  /** \brief Destructor. */
69  virtual ~Region3D () {}
70 
71  /** \brief Get the centroid of the region. */
72  inline Eigen::Vector3f
73  getCentroid () const
74  {
75  return (centroid_);
76  }
77 
78  /** \brief Get the covariance of the region. */
79  inline Eigen::Matrix3f
80  getCovariance () const
81  {
82  return (covariance_);
83  }
84 
85  /** \brief Get the number of points in the region. */
86  unsigned
87  getCount () const
88  {
89  return (count_);
90  }
91 
92  /** \brief Get the curvature of the region. */
93  float
94  getCurvature () const
95  {
96  return (curvature_);
97  }
98 
99  /** \brief Set the curvature of the region. */
100  void
101  setCurvature (float curvature)
102  {
103  curvature_ = curvature;
104  }
105 
106  protected:
107  /** \brief The centroid of the region. */
108  Eigen::Vector3f centroid_;
109 
110  /** \brief The covariance of the region. */
111  Eigen::Matrix3f covariance_;
112 
113  /** \brief The number of points in the region. */
114  unsigned count_;
115 
116  /** \brief The mean curvature of the region. */
117  float curvature_;
118 
119  public:
120  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
121  };
122 }
123 
124 #endif //#ifndef PCL_SEGMENTATION_REGION_3D_H_
float curvature_
The mean curvature of the region.
Definition: region_3d.h:117
Eigen::Vector3f centroid_
The centroid of the region.
Definition: region_3d.h:108
Eigen::Matrix3f getCovariance() const
Get the covariance of the region.
Definition: region_3d.h:80
Definition: bfgs.h:10
Region3D represents summary statistics of a 3D collection of points.
Definition: region_3d.h:50
void setCurvature(float curvature)
Set the curvature of the region.
Definition: region_3d.h:101
virtual ~Region3D()
Destructor.
Definition: region_3d.h:69
Region3D()
Empty constructor for Region3D.
Definition: region_3d.h:54
Region3D(Eigen::Vector3f &centroid, Eigen::Matrix3f &covariance, unsigned count)
Constructor for Region3D.
Definition: region_3d.h:63
Eigen::Vector3f getCentroid() const
Get the centroid of the region.
Definition: region_3d.h:73
unsigned getCount() const
Get the number of points in the region.
Definition: region_3d.h:87
unsigned count_
The number of points in the region.
Definition: region_3d.h:114
float getCurvature() const
Get the curvature of the region.
Definition: region_3d.h:94
Eigen::Matrix3f covariance_
The covariance of the region.
Definition: region_3d.h:111