Skip to content
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

Bugfix: correct array dimension in transform check #37

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="occwl", # package name
version="2.1.0",
version="2.1.1",
author="Pradeep Kumar Jayaraman, Joseph G. Lambourne",
author_email="[email protected], [email protected]",
description="Lightweight Pythonic wrapper around pythonocc",
Expand Down
2 changes: 1 addition & 1 deletion src/occwl/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def transform(self, a, copy=True):
# we don't want to set the values as this
# would give us a geometric identity without
# the identity flag set
if not np.allclose(a, np.eye(4)):
if not np.allclose(a, np.eye(3, 4)):
JJMinton marked this conversation as resolved.
Show resolved Hide resolved
trsf.SetValues(
a[0,0], a[0,1], a[0,2], a[0, 3],
a[1,0], a[1,1], a[1,2], a[1, 3],
Expand Down
22 changes: 22 additions & 0 deletions tests/test_solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,25 @@ def run_test(self, solid):
self.assertTrue(split_solid is not None)
num_edges_after_splitting = split_solid.num_edges()
self.assertLessEqual(num_original_edges, num_edges_after_splitting)

class TransformTester(TestBase):
def test_smoke(self):
box = Solid.make_box(1, 1, 1)
with self.subTest("identity"):
box.transform(
np.array([
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
]),
copy=True,
)
with self.subTest("nonidentity"):
box.transform(
np.array([
[0, 1, 0, 1.],
[0, 0, 1, 2.],
[1, 0, 0, 3.],
]),
copy=True,
)