Point Cloud Library (PCL)  1.11.1
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 #pragma once
39 
40 #include <Eigen/Core>
41 #include <vector>
42 
43 #include <pcl/memory.h>
44 #include <pcl/pcl_macros.h>
45 
46 namespace pcl
47 {
48  /** \brief Region3D represents summary statistics of a 3D collection of points.
49  * \author Alex Trevor
50  */
51  template <typename PointT>
52  class Region3D
53  {
54  public:
55  /** \brief Empty constructor for Region3D. */
56  Region3D () : centroid_ (Eigen::Vector3f::Zero ()), covariance_ (Eigen::Matrix3f::Identity ()), count_ (0)
57  {
58  }
59 
60  /** \brief Constructor for Region3D.
61  * \param[in] centroid The centroid of the region.
62  * \param[in] covariance The covariance of the region.
63  * \param[in] count The number of points in the region.
64  */
65  Region3D (Eigen::Vector3f& centroid, Eigen::Matrix3f& covariance, unsigned count)
66  : centroid_ (centroid), covariance_ (covariance), count_ (count)
67  {
68  }
69 
70  /** \brief Destructor. */
71  virtual ~Region3D () {}
72 
73  /** \brief Get the centroid of the region. */
74  inline Eigen::Vector3f
75  getCentroid () const
76  {
77  return (centroid_);
78  }
79 
80  /** \brief Get the covariance of the region. */
81  inline Eigen::Matrix3f
82  getCovariance () const
83  {
84  return (covariance_);
85  }
86 
87  /** \brief Get the number of points in the region. */
88  unsigned
89  getCount () const
90  {
91  return (count_);
92  }
93 
94  /** \brief Get the curvature of the region. */
95  float
96  getCurvature () const
97  {
98  return (curvature_);
99  }
100 
101  /** \brief Set the curvature of the region. */
102  void
103  setCurvature (float curvature)
104  {
105  curvature_ = curvature;
106  }
107 
108  protected:
109  /** \brief The centroid of the region. */
110  Eigen::Vector3f centroid_;
111 
112  /** \brief The covariance of the region. */
113  Eigen::Matrix3f covariance_;
114 
115  /** \brief The number of points in the region. */
116  unsigned count_;
117 
118  /** \brief The mean curvature of the region. */
119  float curvature_;
120 
121  public:
123  };
124 }
float curvature_
The mean curvature of the region.
Definition: region_3d.h:119
Defines functions, macros and traits for allocating and using memory.
Eigen::Vector3f centroid_
The centroid of the region.
Definition: region_3d.h:110
Eigen::Matrix3f getCovariance() const
Get the covariance of the region.
Definition: region_3d.h:82
Eigen::Vector3f getCentroid() const
Get the centroid of the region.
Definition: region_3d.h:75
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
Definition: bfgs.h:9
Region3D represents summary statistics of a 3D collection of points.
Definition: region_3d.h:52
void setCurvature(float curvature)
Set the curvature of the region.
Definition: region_3d.h:103
float getCurvature() const
Get the curvature of the region.
Definition: region_3d.h:96
virtual ~Region3D()
Destructor.
Definition: region_3d.h:71
Region3D()
Empty constructor for Region3D.
Definition: region_3d.h:56
Region3D(Eigen::Vector3f &centroid, Eigen::Matrix3f &covariance, unsigned count)
Constructor for Region3D.
Definition: region_3d.h:65
unsigned count_
The number of points in the region.
Definition: region_3d.h:116
Eigen::Matrix3f covariance_
The covariance of the region.
Definition: region_3d.h:113
unsigned getCount() const
Get the number of points in the region.
Definition: region_3d.h:89
Defines all the PCL and non-PCL macros used.