You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Python issues, I have tested with the latest development wheel. That page currently lists no wheel links, so I reproduced with 0.19.0 from PyPI and confirmed the code path is unchanged on main at 1a9eb99, see the permalink below.
"A general transform of an OrientedBoundingBox is not implemented. "
"Call Translate, Scale, and Rotate.");
return *this;
}
An oriented bounding box is stored as a center, a rotation matrix and an extent, so it is closed under any similarity transform (rotation, uniform scale, translation): only the center and the rotation move, and the extent scales. That is exactly the case that matters in practice, where a box is carried between coordinate frames next to the point cloud it bounds:
The suggested workaround ("Call Translate, Scale, and Rotate") is easy to get wrong, because Rotate(R) rotates about the box center by default while Transform() rotates about the origin. How to transform pointcloud and bounding box in the same way? #4875 is exactly that mistake, and the usual fix people land on is to rebuild the box by hand:
geometry::OrientedBoundingEllipsoid::Transform() on main has the same body and the same limitation.
A general affine transform genuinely cannot be supported, since shear or non-uniform scale turns the box into a parallelepiped and the ellipsoid into a general quadric. Those cases should keep raising. The similarity case should not.
Steps to reproduce the bug
importnumpyasnpimportopen3daso3dbox=o3d.geometry.OrientedBoundingBox([1, 2, 3], np.eye(3), [2, 4, 6])
transformation=np.eye(4)
transformation[:3, 3] = [1, 0, 0] # translate by 1 along xbox.transform(transformation)
Error message
Traceback (most recent call last):
File "<string>", line 5, in <module>
RuntimeError: [Open3D Error] (virtual open3d::geometry::OrientedBoundingBox& open3d::geometry::OrientedBoundingBox::Transform(const Matrix4d&)) /root/Open3D/cpp/open3d/geometry/BoundingVolume.cpp:58: A general transform of an OrientedBoundingBox is not implemented. Call Translate, Scale, and Rotate.
Expected behavior
A similarity transform is applied to the box: center_ is mapped by the transform, R_ is premultiplied by its rotation part and extent_ is multiplied by its uniform scale. The corners of the result are then the transformed corners of the original box, which is what transforming a point cloud of those corners with the same matrix gives.
A transform with shear, non-uniform scale, mirroring or a projective part keeps raising, with a message that names which part is not supported.
Open3D, Python and System information
- Operating system: Ubuntu 24.04 64-bit
- Python version: 3.12.3
- Open3D version: 0.19.0, and the source of `main` at 1a9eb990f9a20936c30c428568c602bdef760744
- System architecture: x86_64
- Is this a remote workstation?: no
- How did you install Open3D?: pip, and separately built from source for the C++ side
- Compiler version (if built from source): gcc 13.3
Additional information
I have a fix ready and will open a PR that implements Transform() for similarity transforms on both OrientedBoundingBox and OrientedBoundingEllipsoid, reusing the existing Rotate(), Scale() and Translate() primitives, with C++ and Python unit tests for the supported and the rejected cases.
Checklist
mainat 1a9eb99, see the permalink below.mainbranch).Describe the issue
geometry::OrientedBoundingBox::Transform()always raises, even for a plain rigid transform:Open3D/cpp/open3d/geometry/BoundingVolume.cpp
Lines 154 to 160 in 1a9eb99
An oriented bounding box is stored as a center, a rotation matrix and an extent, so it is closed under any similarity transform (rotation, uniform scale, translation): only the center and the rotation move, and the extent scales. That is exactly the case that matters in practice, where a box is carried between coordinate frames next to the point cloud it bounds:
cloud.Transform(target_T_source); box.Transform(target_T_source); // throwsThree things make the current behavior surprising:
Geometry3DacceptsTransform(), so a box cannot be moved through generic code that transforms a geometry.Rotate()followed byTranslate(), so the legacy and tensor APIs disagree on the same operation:Open3D/cpp/open3d/t/geometry/BoundingVolume.cpp
Lines 464 to 478 in 1a9eb99
Rotate(R)rotates about the box center by default whileTransform()rotates about the origin. How to transform pointcloud and bounding box in the same way? #4875 is exactly that mistake, and the usual fix people land on is to rebuild the box by hand:OrientedBoundingBox transformed(transform * box.center_, transform.rotation() * box.R_, box.extent_);geometry::OrientedBoundingEllipsoid::Transform()onmainhas the same body and the same limitation.A general affine transform genuinely cannot be supported, since shear or non-uniform scale turns the box into a parallelepiped and the ellipsoid into a general quadric. Those cases should keep raising. The similarity case should not.
Steps to reproduce the bug
Error message
Expected behavior
A similarity transform is applied to the box:
center_is mapped by the transform,R_is premultiplied by its rotation part andextent_is multiplied by its uniform scale. The corners of the result are then the transformed corners of the original box, which is what transforming a point cloud of those corners with the same matrix gives.A transform with shear, non-uniform scale, mirroring or a projective part keeps raising, with a message that names which part is not supported.
Open3D, Python and System information
Additional information
I have a fix ready and will open a PR that implements
Transform()for similarity transforms on bothOrientedBoundingBoxandOrientedBoundingEllipsoid, reusing the existingRotate(),Scale()andTranslate()primitives, with C++ and Python unit tests for the supported and the rejected cases.