From eba27ef9221aef823e9a60d9aae77049fabc1b7d Mon Sep 17 00:00:00 2001 From: Saurabh Khanduja Date: Sun, 22 Oct 2023 22:31:17 +0200 Subject: [PATCH 1/3] Correct tensor printing format when tensor is in gpu. --- cpp/open3d/core/Tensor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/open3d/core/Tensor.cpp b/cpp/open3d/core/Tensor.cpp index 9ee485bd63a..d405c501993 100644 --- a/cpp/open3d/core/Tensor.cpp +++ b/cpp/open3d/core/Tensor.cpp @@ -750,7 +750,7 @@ std::string Tensor::ToString(bool with_suffix, std::ostringstream rc; if (IsCUDA() || !IsContiguous()) { Tensor host_contiguous_tensor = Contiguous().To(Device("CPU:0")); - rc << host_contiguous_tensor.ToString(false, ""); + rc << host_contiguous_tensor.ToString(with_suffix, indent); } else { if (shape_.NumElements() == 0) { rc << indent; From 20df84303786a95da44204f15a99f0b2e36a67a7 Mon Sep 17 00:00:00 2001 From: Saurabh Khanduja Date: Sun, 22 Oct 2023 22:51:41 +0200 Subject: [PATCH 2/3] Fix #6436 - add bound check for axis aligned bounding box --- cpp/open3d/geometry/BoundingVolume.cpp | 16 ++++++++++++++++ cpp/open3d/geometry/BoundingVolume.h | 6 +----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cpp/open3d/geometry/BoundingVolume.cpp b/cpp/open3d/geometry/BoundingVolume.cpp index 1bac823f524..ba2594b6ba3 100644 --- a/cpp/open3d/geometry/BoundingVolume.cpp +++ b/cpp/open3d/geometry/BoundingVolume.cpp @@ -256,6 +256,22 @@ OrientedBoundingBox AxisAlignedBoundingBox::GetMinimalOrientedBoundingBox( return OrientedBoundingBox::CreateFromAxisAlignedBoundingBox(*this); } +AxisAlignedBoundingBox::AxisAlignedBoundingBox(const Eigen::Vector3d& min_bound, + const Eigen::Vector3d& max_bound) + : Geometry3D(Geometry::GeometryType::AxisAlignedBoundingBox), + min_bound_(min_bound), + max_bound_(max_bound), + color_(1, 1, 1) { + if ((max_bound_.array() < min_bound_.array()).any()) { + open3d::utility::LogWarning( + "max_bound {} of bounding box is smaller than min_bound {} in " + "one or more axes. Fix input values to remove this warning.", + max_bound_, min_bound_); + max_bound_ = max_bound.cwiseMax(min_bound); + min_bound_ = max_bound.cwiseMin(min_bound); + } +} + AxisAlignedBoundingBox& AxisAlignedBoundingBox::Transform( const Eigen::Matrix4d& transformation) { utility::LogError( diff --git a/cpp/open3d/geometry/BoundingVolume.h b/cpp/open3d/geometry/BoundingVolume.h index e808b232612..76cdca5977d 100644 --- a/cpp/open3d/geometry/BoundingVolume.h +++ b/cpp/open3d/geometry/BoundingVolume.h @@ -171,11 +171,7 @@ class AxisAlignedBoundingBox : public Geometry3D { /// \param min_bound Lower bounds of the bounding box for all axes. /// \param max_bound Upper bounds of the bounding box for all axes. AxisAlignedBoundingBox(const Eigen::Vector3d& min_bound, - const Eigen::Vector3d& max_bound) - : Geometry3D(Geometry::GeometryType::AxisAlignedBoundingBox), - min_bound_(min_bound), - max_bound_(max_bound), - color_(1, 1, 1) {} + const Eigen::Vector3d& max_bound); ~AxisAlignedBoundingBox() override {} public: From 0afb67e357e40b67418ed1abab24b80bc37d8768 Mon Sep 17 00:00:00 2001 From: Saurabh Khanduja Date: Sun, 22 Oct 2023 23:05:01 +0200 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8965478f135..7e498e63a45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Changed TriangleMesh to store materials in a list so they can be accessed by the material index (PR #5938) * Support multi-threading in the RayCastingScene function to commit scene (PR #6051). * Fix some bad triangle generation in TriangleMesh::SimplifyQuadricDecimation +* Fix printing of tensor in gpu and add validation check for bounds of axis-aligned bounding box (PR #6444) ## 0.13