diff --git a/stltovoxel/polygon_repair.py b/stltovoxel/polygon_repair.py index 8eb9cf1..92c3784 100644 --- a/stltovoxel/polygon_repair.py +++ b/stltovoxel/polygon_repair.py @@ -1,6 +1,7 @@ import numpy as np import math + def find_polylines(segments): # noqa: C901 polylines = [] segment_forward_dict = {} @@ -94,7 +95,7 @@ def atan_sum(f1, f2): # atan2(atan_sum(f1, f2)) == atan2(f1) + atan2(f2) x1, y1 = f1 x2, y2 = f2 - return ( x1*x2 - y1*y2, y1*x2 + x1*y2) + return (x1*x2 - y1*y2, y1*x2 + x1*y2) def atan_neg(f1): diff --git a/test/test_winding_query.py b/test/test_polygon_repair.py similarity index 98% rename from test/test_winding_query.py rename to test/test_polygon_repair.py index 9f03956..f52f76f 100644 --- a/test/test_winding_query.py +++ b/test/test_polygon_repair.py @@ -1,11 +1,10 @@ -import unittest -import math import numpy as np +import unittest from stltovoxel import polygon_repair -class TestWindingQuery(unittest.TestCase): +class TestPolygonRepair(unittest.TestCase): def tuples_almost_equal(self, actual, expected): for ac_val, exp_val in zip(actual, expected): self.assertAlmostEqual(ac_val, exp_val, 3, f"{actual} != {expected}") @@ -68,7 +67,6 @@ def test_grad_90_norm(self): expected = polygon_repair.normalize((-1, -1)) self.tuples_almost_equal(actual, expected) - def test_grad_90_norm2(self): segs = [((0, 0), (1, 0)), ((1, 0), (1, 1)), ((1, 1), (0, 1))] pos = (0, 0.5) @@ -92,7 +90,7 @@ def test_grad_90_norm3(self): actual = polygon_repair.winding_contour(pos, segs) expected = polygon_repair.normalize((-1, -1)) self.tuples_almost_equal(actual, expected) - + if __name__ == '__main__': unittest.main()