diff --git a/src/classy_blocks/construct/curves/analytic.py b/src/classy_blocks/construct/curves/analytic.py index 02ac4b4d..e6e2b61e 100644 --- a/src/classy_blocks/construct/curves/analytic.py +++ b/src/classy_blocks/construct/curves/analytic.py @@ -18,8 +18,8 @@ def parts(self): raise NotImplementedError("Transforming analytic curves is currently not supported") -# class CircleCurve(AnalyticCurve): -# TODO! - # class LineCurve(AnalyticCurve): +# def __init__(self, point_1:PointType, point_2:PointType): + +# class CircleCurve(AnalyticCurve): # TODO! diff --git a/src/classy_blocks/util/curves.py b/src/classy_blocks/util/curves.py deleted file mode 100644 index dd569282..00000000 --- a/src/classy_blocks/util/curves.py +++ /dev/null @@ -1,32 +0,0 @@ -# stuff that works on lists of points - -from typing import Literal - -import numpy as np -import scipy.spatial - -from classy_blocks.util import functions as f - - -def dilute_indexes(max_index_val: int, num_of_points: int) -> np.ndarray: - """Generate points from an array of length .""" - return np.round(np.linspace(0, max_index_val - 1, num_of_points)).astype(int) - - -def dilute_points(points: np.ndarray, num_of_points: int) -> np.ndarray: - """from an array of , choose equally-spaced points""" - return points[dilute_indexes(len(points), num_of_points)] - - -def curve_length(points) -> float: - """returns length of a curve given by """ - num = 0 - for i in range(len(points) - 1): - num += scipy.spatial.distance.euclidean(points[i], points[i + 1]) - - return num - - -def to_cartesian(points, direction: Literal[1, -1] = 1, rotation_axis: Literal["x", "z"] = "z") -> np.ndarray: - """same as functions.to_cartesian but works on a list of points""" - return np.array([f.to_cartesian(point, direction, rotation_axis) for point in points]) diff --git a/tests/test_util/test_functions.py b/tests/test_util/test_functions.py index be2c433d..dd29159f 100644 --- a/tests/test_util/test_functions.py +++ b/tests/test_util/test_functions.py @@ -2,7 +2,6 @@ import numpy as np -from classy_blocks.util import curves as c from classy_blocks.util import functions as f @@ -120,40 +119,6 @@ def test_to_cartesian_asserts(self): with self.assertRaises(ValueError): f.to_cartesian(p, axis="a") - def test_dilute_indexes(self): - """generate equally-spaced indexes""" - self.assert_np_equal(c.dilute_indexes(11, 6), np.array([0, 2, 4, 6, 8, 10])) - - def test_dilute_points(self): - """return equally-spaced elements of an array""" - points = np.array([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]) - diluted_points = c.dilute_points(points, 6) - - self.assert_np_equal(diluted_points, np.array([2, 6, 10, 14, 18, 22])) - - def test_curve_length(self): - """length of a curve given by a list of points""" - curve = np.array( - [ - f.vector(0, 0, 0), - f.vector(1, 0, 0), - f.vector(1, 1, 0), - f.vector(1, 2, 0), - f.vector(0, 2, 0), - ] - ) - - self.assertAlmostEqual(c.curve_length(curve), 4) - - def test_to_cartesian_curve(self): - """f.to_cartesian() for a list of points""" - # polar points - points = [f.vector(1, 0, 0), f.vector(1, np.pi / 2, 1), f.vector(2, 0, 1)] - - self.assert_np_almost_equal( - c.to_cartesian(points), np.array([f.vector(1, 0, 0), f.vector(0, 1, 1), f.vector(2, 0, 1)]) - ) - def test_arc_length_3point_half(self): a = f.vector(0, 0, 0) b = f.vector(1, 1, 0)