diff --git a/pyproject.toml b/pyproject.toml index 3972d681..0ecc98ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "shapepy" -version = "1.1.2" +version = "1.1.3" description = "Geometric 2D library" authors = ["Carlos Adir "] readme = "README.md" diff --git a/src/shapepy/__init__.py b/src/shapepy/__init__.py index 76bd8a96..075f1817 100644 --- a/src/shapepy/__init__.py +++ b/src/shapepy/__init__.py @@ -7,12 +7,8 @@ import importlib -from shapepy.curve import IntegratePlanar, PlanarCurve -from shapepy.jordancurve import IntegrateJordan, JordanCurve -from shapepy.plot import ShapePloter -from shapepy.polygon import Point2D -from shapepy.primitive import Primitive -from shapepy.shape import ( +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import ( ConnectedShape, DisjointShape, EmptyShape, @@ -20,6 +16,10 @@ SimpleShape, WholeShape, ) +from shapepy.geometry.curve import IntegratePlanar, PlanarCurve +from shapepy.geometry.jordancurve import IntegrateJordan, JordanCurve +from shapepy.geometry.polygon import Point2D +from shapepy.plot.plot import ShapePloter __version__ = importlib.metadata.version("shapepy") diff --git a/src/shapepy/bool2d/__init__.py b/src/shapepy/bool2d/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/shapepy/primitive.py b/src/shapepy/bool2d/primitive.py similarity index 97% rename from src/shapepy/primitive.py rename to src/shapepy/bool2d/primitive.py index a029c132..5fca03b8 100644 --- a/src/shapepy/primitive.py +++ b/src/shapepy/bool2d/primitive.py @@ -14,10 +14,10 @@ import numpy as np -from shapepy.curve import PlanarCurve -from shapepy.jordancurve import JordanCurve -from shapepy.polygon import Point2D -from shapepy.shape import EmptyShape, SimpleShape, WholeShape +from shapepy.bool2d.shape import EmptyShape, SimpleShape, WholeShape +from shapepy.geometry.curve import PlanarCurve +from shapepy.geometry.jordancurve import JordanCurve +from shapepy.geometry.polygon import Point2D class Primitive: diff --git a/src/shapepy/shape.py b/src/shapepy/bool2d/shape.py similarity index 99% rename from src/shapepy/shape.py rename to src/shapepy/bool2d/shape.py index b1177586..41749d72 100644 --- a/src/shapepy/shape.py +++ b/src/shapepy/bool2d/shape.py @@ -16,8 +16,8 @@ import numpy as np -from shapepy.jordancurve import IntegrateJordan, JordanCurve -from shapepy.polygon import Box, Point2D +from shapepy.geometry.jordancurve import IntegrateJordan, JordanCurve +from shapepy.geometry.polygon import Box, Point2D class SuperclassMeta(type): diff --git a/src/shapepy/geometry/__init__.py b/src/shapepy/geometry/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/shapepy/curve.py b/src/shapepy/geometry/curve.py similarity index 99% rename from src/shapepy/curve.py rename to src/shapepy/geometry/curve.py index 815356e3..3c8a002d 100644 --- a/src/shapepy/curve.py +++ b/src/shapepy/geometry/curve.py @@ -20,7 +20,7 @@ import numpy as np import pynurbs -from shapepy.polygon import Box, Point2D +from shapepy.geometry.polygon import Box, Point2D class Math: diff --git a/src/shapepy/jordancurve.py b/src/shapepy/geometry/jordancurve.py similarity index 99% rename from src/shapepy/jordancurve.py rename to src/shapepy/geometry/jordancurve.py index 076460de..cc4a3d16 100644 --- a/src/shapepy/jordancurve.py +++ b/src/shapepy/geometry/jordancurve.py @@ -11,8 +11,8 @@ import numpy as np -from shapepy.curve import IntegratePlanar, PlanarCurve -from shapepy.polygon import Box, Point2D +from shapepy.geometry.curve import IntegratePlanar, PlanarCurve +from shapepy.geometry.polygon import Box, Point2D class IntegrateJordan: diff --git a/src/shapepy/polygon.py b/src/shapepy/geometry/polygon.py similarity index 100% rename from src/shapepy/polygon.py rename to src/shapepy/geometry/polygon.py diff --git a/src/shapepy/plot/__init__.py b/src/shapepy/plot/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/shapepy/plot.py b/src/shapepy/plot/plot.py similarity index 97% rename from src/shapepy/plot.py rename to src/shapepy/plot/plot.py index 08233782..0897f894 100644 --- a/src/shapepy/plot.py +++ b/src/shapepy/plot/plot.py @@ -11,15 +11,15 @@ import numpy as np from matplotlib import pyplot -from shapepy.curve import PlanarCurve -from shapepy.jordancurve import JordanCurve -from shapepy.shape import ( +from shapepy.bool2d.shape import ( BaseShape, ConnectedShape, DisjointShape, EmptyShape, WholeShape, ) +from shapepy.geometry.curve import PlanarCurve +from shapepy.geometry.jordancurve import JordanCurve Path = matplotlib.path.Path PathPatch = matplotlib.patches.PathPatch diff --git a/tests/bool2d/__init__.py b/tests/bool2d/__init__.py new file mode 100644 index 00000000..04ddc643 --- /dev/null +++ b/tests/bool2d/__init__.py @@ -0,0 +1,3 @@ +import sys + +sys.path.append("./src") diff --git a/tests/test_bool_finite_intersect.py b/tests/bool2d/test_bool_finite_intersect.py similarity index 86% rename from tests/test_bool_finite_intersect.py rename to tests/bool2d/test_bool_finite_intersect.py index eb3a9aab..732f6f78 100644 --- a/tests/test_bool_finite_intersect.py +++ b/tests/bool2d/test_bool_finite_intersect.py @@ -5,20 +5,20 @@ import pytest -from shapepy.jordancurve import JordanCurve -from shapepy.primitive import Primitive -from shapepy.shape import SimpleShape +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import SimpleShape +from shapepy.geometry.jordancurve import JordanCurve @pytest.mark.order(9) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", - "tests/test_contains.py::test_end", - "tests/test_empty_whole.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", + "tests/bool2d/test_contains.py::test_end", + "tests/bool2d/test_empty_whole.py::test_end", ], scope="session", ) diff --git a/tests/test_bool_infinite_intersect.py b/tests/bool2d/test_bool_infinite_intersect.py similarity index 87% rename from tests/test_bool_infinite_intersect.py rename to tests/bool2d/test_bool_infinite_intersect.py index e17488aa..ea3728d7 100644 --- a/tests/test_bool_infinite_intersect.py +++ b/tests/bool2d/test_bool_infinite_intersect.py @@ -4,18 +4,18 @@ import pytest -from shapepy.primitive import Primitive +from shapepy.bool2d.primitive import Primitive @pytest.mark.order(9) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", - "tests/test_contains.py::test_end", - "tests/test_empty_whole.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", + "tests/bool2d/test_contains.py::test_end", + "tests/bool2d/test_empty_whole.py::test_end", ], scope="session", ) diff --git a/tests/test_bool_no_intersect.py b/tests/bool2d/test_bool_no_intersect.py similarity index 97% rename from tests/test_bool_no_intersect.py rename to tests/bool2d/test_bool_no_intersect.py index 1ba0f684..5bbc498b 100644 --- a/tests/test_bool_no_intersect.py +++ b/tests/bool2d/test_bool_no_intersect.py @@ -5,19 +5,24 @@ import pytest -from shapepy.primitive import Primitive -from shapepy.shape import ConnectedShape, DisjointShape, EmptyShape, WholeShape +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import ( + ConnectedShape, + DisjointShape, + EmptyShape, + WholeShape, +) @pytest.mark.order(9) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", - "tests/test_contains.py::test_end", - "tests/test_empty_whole.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", + "tests/bool2d/test_contains.py::test_end", + "tests/bool2d/test_empty_whole.py::test_end", ], scope="session", ) diff --git a/tests/test_contains.py b/tests/bool2d/test_contains.py similarity index 98% rename from tests/test_contains.py rename to tests/bool2d/test_contains.py index 167201d5..9a42f510 100644 --- a/tests/test_contains.py +++ b/tests/bool2d/test_contains.py @@ -8,18 +8,23 @@ import numpy as np import pytest -from shapepy.jordancurve import JordanCurve -from shapepy.primitive import Primitive -from shapepy.shape import ConnectedShape, DisjointShape, EmptyShape, WholeShape +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import ( + ConnectedShape, + DisjointShape, + EmptyShape, + WholeShape, +) +from shapepy.geometry.jordancurve import JordanCurve @pytest.mark.order(7) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", ], scope="session", ) diff --git a/tests/test_empty_whole.py b/tests/bool2d/test_empty_whole.py similarity index 94% rename from tests/test_empty_whole.py rename to tests/bool2d/test_empty_whole.py index 75970343..703731d0 100644 --- a/tests/test_empty_whole.py +++ b/tests/bool2d/test_empty_whole.py @@ -7,18 +7,18 @@ import pytest -from shapepy.primitive import Primitive -from shapepy.shape import EmptyShape, WholeShape +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import EmptyShape, WholeShape @pytest.mark.order(8) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", - "tests/test_contains.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", + "tests/bool2d/test_contains.py::test_end", ], scope="session", ) diff --git a/tests/test_primitive.py b/tests/bool2d/test_primitive.py similarity index 97% rename from tests/test_primitive.py rename to tests/bool2d/test_primitive.py index 87eae39e..d1d72680 100644 --- a/tests/test_primitive.py +++ b/tests/bool2d/test_primitive.py @@ -12,8 +12,8 @@ @pytest.mark.order(5) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", ], scope="session", ) diff --git a/tests/test_shape.py b/tests/bool2d/test_shape.py similarity index 90% rename from tests/test_shape.py rename to tests/bool2d/test_shape.py index 0db91c64..1968f2c2 100644 --- a/tests/test_shape.py +++ b/tests/bool2d/test_shape.py @@ -7,20 +7,20 @@ import pytest -from shapepy.jordancurve import JordanCurve -from shapepy.primitive import Primitive -from shapepy.shape import IntegrateShape, SimpleShape +from shapepy.bool2d.primitive import Primitive +from shapepy.bool2d.shape import IntegrateShape, SimpleShape +from shapepy.geometry.jordancurve import JordanCurve @pytest.mark.order(8) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_jordan_polygon.py::test_end", - "tests/test_jordan_curve.py::test_end", - "tests/test_primitive.py::test_end", - "tests/test_contains.py::test_end", - "tests/test_empty_whole.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", + "tests/geometry/test_jordan_curve.py::test_end", + "tests/bool2d/test_primitive.py::test_end", + "tests/bool2d/test_contains.py::test_end", + "tests/bool2d/test_empty_whole.py::test_end", ], scope="session", ) diff --git a/tests/geometry/__init__.py b/tests/geometry/__init__.py new file mode 100644 index 00000000..04ddc643 --- /dev/null +++ b/tests/geometry/__init__.py @@ -0,0 +1,3 @@ +import sys + +sys.path.append("./src") diff --git a/tests/test_curve.py b/tests/geometry/test_curve.py similarity index 98% rename from tests/test_curve.py rename to tests/geometry/test_curve.py index 139b61c7..7392d77a 100644 --- a/tests/test_curve.py +++ b/tests/geometry/test_curve.py @@ -8,13 +8,18 @@ import numpy as np import pytest -from shapepy.curve import BezierCurve, IntegratePlanar, Math, PlanarCurve +from shapepy.geometry.curve import ( + BezierCurve, + IntegratePlanar, + Math, + PlanarCurve, +) @pytest.mark.order(3) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", + "tests/geometry/test_polygon.py::test_end", ], scope="session", ) diff --git a/tests/test_jordan_curve.py b/tests/geometry/test_jordan_curve.py similarity index 94% rename from tests/test_jordan_curve.py rename to tests/geometry/test_jordan_curve.py index 36bf37a6..1cf6db94 100644 --- a/tests/test_jordan_curve.py +++ b/tests/geometry/test_jordan_curve.py @@ -9,15 +9,15 @@ import pytest from shapepy import Point2D -from shapepy.jordancurve import JordanCurve +from shapepy.geometry.jordancurve import JordanCurve @pytest.mark.order(6) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_curve.py::test_end", - "tests/test_jordan_polygon.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_curve.py::test_end", + "tests/geometry/test_jordan_polygon.py::test_end", ], scope="session", ) diff --git a/tests/test_jordan_polygon.py b/tests/geometry/test_jordan_polygon.py similarity index 99% rename from tests/test_jordan_polygon.py rename to tests/geometry/test_jordan_polygon.py index d60a2a9d..303f3832 100644 --- a/tests/test_jordan_polygon.py +++ b/tests/geometry/test_jordan_polygon.py @@ -7,14 +7,14 @@ import numpy as np import pytest -from shapepy.jordancurve import IntegrateJordan, JordanCurve +from shapepy.geometry.jordancurve import IntegrateJordan, JordanCurve @pytest.mark.order(4) @pytest.mark.dependency( depends=[ - "tests/test_polygon.py::test_end", - "tests/test_curve.py::test_end", + "tests/geometry/test_polygon.py::test_end", + "tests/geometry/test_curve.py::test_end", ], scope="session", ) diff --git a/tests/test_polygon.py b/tests/geometry/test_polygon.py similarity index 99% rename from tests/test_polygon.py rename to tests/geometry/test_polygon.py index 34254da3..9b78cd37 100644 --- a/tests/test_polygon.py +++ b/tests/geometry/test_polygon.py @@ -6,7 +6,7 @@ import pytest -from shapepy.polygon import Point2D +from shapepy.geometry.polygon import Point2D @pytest.mark.order(2) diff --git a/tests/plot/__init__.py b/tests/plot/__init__.py new file mode 100644 index 00000000..04ddc643 --- /dev/null +++ b/tests/plot/__init__.py @@ -0,0 +1,3 @@ +import sys + +sys.path.append("./src") diff --git a/tests/test_plot.py b/tests/plot/test_plot.py similarity index 97% rename from tests/test_plot.py rename to tests/plot/test_plot.py index e367516b..5ae527a1 100644 --- a/tests/test_plot.py +++ b/tests/plot/test_plot.py @@ -7,13 +7,13 @@ from matplotlib import pyplot from shapepy import ShapePloter -from shapepy.primitive import Primitive +from shapepy.bool2d.primitive import Primitive @pytest.mark.order(13) @pytest.mark.dependency( depends=[ - "tests/test_shape.py::test_end", + "tests/bool2d/test_shape.py::test_end", ], scope="session", )