ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PointCloudPicker.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <Logging.h>
11 #include <ecvBBox.h>
12 #include <ecvOrientedBBox.h>
13 #include <ecvPointCloud.h>
14 
15 namespace cloudViewer {
16 namespace visualization {
17 
19  picked_indices_.clear();
20  return *this;
21 }
22 
24  return (!pointcloud_ptr_ || picked_indices_.empty());
25 }
26 
27 Eigen::Vector3d PointCloudPicker::GetMinBound() const {
28  if (pointcloud_ptr_) {
29  return ((const ccPointCloud&)(*pointcloud_ptr_)).GetMinBound();
30  } else {
31  return Eigen::Vector3d(0.0, 0.0, 0.0);
32  }
33 }
34 
35 Eigen::Vector3d PointCloudPicker::GetMaxBound() const {
36  if (pointcloud_ptr_) {
37  return ((const ccPointCloud&)(*pointcloud_ptr_)).GetMaxBound();
38  } else {
39  return Eigen::Vector3d(0.0, 0.0, 0.0);
40  }
41 }
42 
43 Eigen::Vector3d PointCloudPicker::GetCenter() const {
44  if (pointcloud_ptr_) {
45  return ((const ccPointCloud&)(*pointcloud_ptr_)).GetCenter();
46  } else {
47  return Eigen::Vector3d(0.0, 0.0, 0.0);
48  }
49 }
50 
52  if (pointcloud_ptr_) {
54  ((const ccPointCloud&)(*pointcloud_ptr_)).getPoints());
55  } else {
56  return ccBBox();
57  }
58 }
59 
61  if (pointcloud_ptr_) {
63  ((const ccPointCloud&)(*pointcloud_ptr_)).getPoints());
64  } else {
65  return ecvOrientedBBox();
66  }
67 }
68 
70  const Eigen::Matrix4d& /*transformation*/) {
71  // Do nothing
72  return *this;
73 }
74 
76  const Eigen::Vector3d& translation, bool relative) {
77  // Do nothing
78  return *this;
79 }
80 
82  const Eigen::Vector3d& center) {
83  // Do nothing
84  return *this;
85 }
86 
87 PointCloudPicker& PointCloudPicker::Rotate(const Eigen::Matrix3d& R,
88  const Eigen::Vector3d& center) {
89  // Do nothing
90  return *this;
91 }
92 
93 bool PointCloudPicker::SetPointCloud(std::shared_ptr<const ccHObject> ptr) {
94  if (!ptr || !ptr->isKindOf(CV_TYPES::POINT_CLOUD)) {
95  return false;
96  }
97  pointcloud_ptr_ = ptr;
98  return true;
99 }
100 
101 } // namespace visualization
102 } // namespace cloudViewer
Bounding box structure.
Definition: ecvBBox.h:25
static ccBBox CreateFromPoints(const std::vector< CCVector3 > &points)
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
A utility class to store picked points of a pointcloud.
virtual PointCloudPicker & Translate(const Eigen::Vector3d &translation, bool relative=true) override
Apply translation to the geometry coordinates.
virtual PointCloudPicker & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &center) override
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
virtual Eigen::Vector3d GetMinBound() const override
Returns min bounds for geometry coordinates.
virtual ecvOrientedBBox GetOrientedBoundingBox() const override
bool SetPointCloud(std::shared_ptr< const ccHObject > ptr)
virtual ccBBox GetAxisAlignedBoundingBox() const override
Returns an axis-aligned bounding box of the geometry.
std::shared_ptr< const ccHObject > pointcloud_ptr_
virtual PointCloudPicker & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
virtual Eigen::Vector3d GetMaxBound() const override
Returns max bounds for geometry coordinates.
virtual PointCloudPicker & Scale(const double s, const Eigen::Vector3d &center) override
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
virtual Eigen::Vector3d GetCenter() const override
Returns the center of the geometry coordinates.
static ecvOrientedBBox CreateFromPoints(const std::vector< Eigen::Vector3d > &points)
@ POINT_CLOUD
Definition: CVTypes.h:104
Generic file read and write utility for python interface.