DART 6.8.5
Loading...
Searching...
No Matches
PointCloudShape.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2019, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_DYNAMICS_POINTCLOUDSHAPE_HPP_
34#define DART_DYNAMICS_POINTCLOUDSHAPE_HPP_
35
37
38#if HAVE_OCTOMAP
39#include <octomap/Pointcloud.h>
40#endif
41
42namespace dart {
43namespace dynamics {
44
46class PointCloudShape : public Shape
47{
48public:
52 explicit PointCloudShape(double visualSize = 0.01);
53
55 ~PointCloudShape() override = default;
56
57 // Documentation inherited.
58 const std::string& getType() const override;
59
60 // Documentation inherited.
61 Eigen::Matrix3d computeInertia(double mass) const override;
62
64 static const std::string& getStaticType();
65
67 void reserve(std::size_t size);
68
70 void addPoint(const Eigen::Vector3d& point);
71
73 void addPoint(const std::vector<Eigen::Vector3d>& points);
74
76 void setPoint(const std::vector<Eigen::Vector3d>& points);
77
78#if HAVE_OCTOMAP
80 void setPoints(::octomap::Pointcloud& pointCloud);
81
83 void addPoints(::octomap::Pointcloud& pointCloud);
84#endif
85
87 const std::vector<Eigen::Vector3d>& getPoints() const;
88
90 std::size_t getNumPoints() const;
91
93 void removeAllPoints();
94
96 void setVisualSize(double size);
97
99 double getVisualSize() const;
100
101protected:
102 // Documentation inherited.
103 void updateVolume() const override;
104
105 // Documentation inherited.
106 void updateBoundingBox() const override;
107
109 std::vector<Eigen::Vector3d> mPoints;
110
113};
114
115} // namespace dynamics
116} // namespace dart
117
118#endif // DART_DYNAMICS_POINTCLOUDSHAPE_HPP_
The PointCloudShape represents point cloud data.
Definition PointCloudShape.hpp:47
double mVisualSize
The size of visual object that represents each point.
Definition PointCloudShape.hpp:112
std::vector< Eigen::Vector3d > mPoints
List of points.
Definition PointCloudShape.hpp:109
std::size_t getNumPoints() const
Returns the number of points.
Definition PointCloudShape.cpp:134
double getVisualSize() const
Returns size of visual object that represents each point.
Definition PointCloudShape.cpp:152
void addPoint(const Eigen::Vector3d &point)
Adds a point to this point cloud.
Definition PointCloudShape.cpp:85
Eigen::Matrix3d computeInertia(double mass) const override
Computes the inertia.
Definition PointCloudShape.cpp:66
void removeAllPoints()
Remove all the points.
Definition PointCloudShape.cpp:140
~PointCloudShape() override=default
Destructor.
void reserve(std::size_t size)
Reserves the point list by size.
Definition PointCloudShape.cpp:79
const std::string & getType() const override
Returns a string representing the shape type.
Definition PointCloudShape.cpp:60
void updateBoundingBox() const override
Updates bounding box.
Definition PointCloudShape.cpp:165
void setPoint(const std::vector< Eigen::Vector3d > &points)
Replaces points with points.
Definition PointCloudShape.cpp:101
void updateVolume() const override
Updates volume.
Definition PointCloudShape.cpp:158
const std::vector< Eigen::Vector3d > & getPoints() const
Returns the list of points.
Definition PointCloudShape.cpp:128
void setVisualSize(double size)
Sets size of visual object that represents each point.
Definition PointCloudShape.cpp:146
static const std::string & getStaticType()
Returns shape type for this class.
Definition PointCloudShape.cpp:72
Definition Shape.hpp:53
Definition BulletCollisionDetector.cpp:63