AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
Expose 4x4 transform matrix through python bindings
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 774
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
The 4x4 transform matrix is not directly accessible through python bindings.
Unless I missed it in the doc, it is only accessible as a string through the `.info()` method, with limited decimals.
My current workaround to recover it for use in numpy/pytorch is to call `indexToWorld` multiple times, but it would be nice to have direct access.
```python
offset = torch.tensor(grid.transform.indexToWorld((0, 0, 0)))
tr = torch.eye(4, dtype=torch.float64)
tr[3, :3] = offset
tr[0, :3] = torch.tensor(grid.transform.indexToWorld((1, 0, 0))) - offset
tr[1, :3] = torch.tensor(grid.transform.indexToWorld((0, 1, 0))) - offset
tr[2, :3] = torch.tensor(grid.transform.indexToWorld((0, 0, 1))) - offset
```
Contributor guide
Research direction
Start by locating the Python binding for grid.transform and compare the existing info() and indexToWorld() entry points. Expose the 4x4 transform matrix as numerical data directly through the binding, then verify that Python callers can use it without reconstructing it from repeated indexToWorld() calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100