Skip to content

Commit fefecac

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/read_e57
2 parents 7f4cc3c + 9c8d5ec commit fefecac

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ This python library wraps the [rust e57 library](https://github.com/cry-inc/e57)
66

77
- [x] Proof of concept xml reading
88
- [ ] Read e57 to python dict
9-
- [ ] Read e57 to numpy array
9+
- [ ] Read e57 to numpy array - work in progress - see `read_points` method.
1010
- [ ] Write to e57 (format ?)
1111

12+
## Getting Started
13+
14+
We need a getting started guide - could you write one based on our tests?
15+
16+
## Contributing
17+
18+
All contributions welcome - feature requests, bug reports, documentation, sample files, tests, rust code, python code, sharing the project online / via social media, ...
19+
1220
## Testing
1321

14-
`python -m pytest`
22+
`python -m pytest`

tests/test_e57.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import e57
21
import numpy as np
2+
import pytest
3+
4+
import e57
35

46

57
def test_raw_xml():
@@ -11,3 +13,23 @@ def test_read_points():
1113
pointcloud = e57.read_points(r"testdata/bunnyFloat.e57")
1214
assert isinstance(pointcloud, np.ndarray)
1315
assert len(pointcloud) == 30_571
16+
17+
18+
def test_box_dimensions():
19+
pointcloud: np.ndarray = e57.read_points(r"testdata/bunnyFloat.e57")
20+
max_coords = pointcloud.max(0, None, False, -np.inf)
21+
min_coords = pointcloud.min(0, None, False, np.inf)
22+
X, Y, Z = max_coords - min_coords
23+
assert X == pytest.approx(0.155698)
24+
assert Y == pytest.approx(0.14731)
25+
assert Z == pytest.approx(0.120672)
26+
27+
28+
def test_global_box_center():
29+
pointcloud: np.ndarray = e57.read_points(r"testdata/bunnyFloat.e57")
30+
max_coords = pointcloud.max(0, None, False, -np.inf)
31+
min_coords = pointcloud.min(0, None, False, np.inf)
32+
X, Y, Z = (max_coords + min_coords) / 2
33+
assert X == pytest.approx(-0.016840)
34+
assert Y == pytest.approx(0.113666)
35+
assert Z == pytest.approx(-0.001537)

0 commit comments

Comments
 (0)