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