- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.5k
 
Feat: VoxelGrid transform, rotate, translate and scale #7339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: VoxelGrid transform, rotate, translate and scale #7339
Conversation
- introduce origin_rotation that stores the orienation of the origin point of the grid
| 
           Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements geometric transformation methods (Transform, Rotate, Translate, and Scale) for the VoxelGrid class, addressing issue #3361. The implementation introduces an origin_rotation_ attribute to efficiently handle rotations without modifying individual voxel indices.
Key changes:
- Added 
origin_rotation_matrix attribute to VoxelGrid for tracking grid orientation - Implemented Transform, Rotate, Translate, and Scale methods using lazy transformation approach
 - Updated PLY I/O to serialize/deserialize the rotation matrix
 
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| cpp/tests/geometry/VoxelGrid.cpp | Added comprehensive unit tests for Scale, Translate, Rotate, and Transform operations | 
| cpp/pybind/geometry/voxelgrid.cpp | Exposed origin_rotation attribute to Python API | 
| cpp/open3d/visualization/shader/SimpleShader.cpp | Updated vertex calculation to incorporate origin rotation matrix | 
| cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.cpp | Updated mesh generation to apply rotation transformation | 
| cpp/open3d/io/file_format/FilePLY.cpp | Added serialization/deserialization support for origin_rotation matrix | 
| cpp/open3d/geometry/VoxelGrid.h | Declared new rotation attribute and GetAllVoxelCorners helper method | 
| cpp/open3d/geometry/VoxelGrid.cpp | Implemented transformation methods and updated bound calculations | 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for adding this missing feature. Can you please rename origin_rotation_ to just rotation_ for clarity?
        
          
                cpp/open3d/visualization/rendering/filament/FilamentGeometryBuffersBuilder.cpp
          
            Show resolved
            Hide resolved
        
      - also renamed python bindings and ply reader state origin_rotation to rotation for coherence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lmuffang Looks good. We can merge once CI passes.
Type
Motivation and Context
It was not possible to move around this type of geometry before.
Checklist:
python util/check_style.py --applyto apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
This pr implements the
Transform,Rotate,TranslateandScalemethods for theVoxelGridobject in cpp.It introduces an
origin_transform_attribute to be able to rotate the grid origin easily and efficiently, keeping all voxels indexes the same.Python bindings and docs seem to be already done for these methods.