Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tests/test_e57.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import e57
import numpy as np
import pytest

import e57


def test_raw_xml():
Expand All @@ -11,3 +13,23 @@ def test_read_points():
pointcloud = e57.read_points(r"testdata/bunnyFloat.e57")
assert isinstance(pointcloud, np.ndarray)
assert len(pointcloud) == 30_571


def test_box_dimensions():
pointcloud: np.ndarray = e57.read_points(r"testdata/bunnyFloat.e57")
max_coords = pointcloud.max(0, None, False, -np.inf)
min_coords = pointcloud.min(0, None, False, np.inf)
X, Y, Z = max_coords - min_coords
assert X == pytest.approx(0.155698)
assert Y == pytest.approx(0.14731)
assert Z == pytest.approx(0.120672)


def test_global_box_center():
pointcloud: np.ndarray = e57.read_points(r"testdata/bunnyFloat.e57")
max_coords = pointcloud.max(0, None, False, -np.inf)
min_coords = pointcloud.min(0, None, False, np.inf)
X, Y, Z = (max_coords + min_coords) / 2
assert X == pytest.approx(-0.016840)
assert Y == pytest.approx(0.113666)
assert Z == pytest.approx(-0.001537)