Repository: lace/polliwog

Issue:
Remove partition_segment_old
Seems a safe bet that we'd want to remove a function with this name.

Comments:

Patch:
diff --git a/polliwog/plane/plane.py b/polliwog/plane/plane.py
index fc35b8b..c115070 100644
--- a/polliwog/plane/plane.py
+++ b/polliwog/plane/plane.py
@@ -141,7 +141,6 @@ class Plane(object):
         the plane (away from the normal), and 0 for points on the plane.
 
         """
-        vg.shape.check(locals(), "points", (-1, 3))
         return np.sign(self.signed_distance(points))
 
     def points_in_front(self, points, inverted=False, ret_indices=False):
@@ -180,7 +179,6 @@ class Plane(object):
         return functions.signed_distance_to_plane(points, self.equation)
 
     def distance(self, points):
-        vg.shape.check(locals(), "points", (-1, 3))
         return np.absolute(self.signed_distance(points))
 
     def project_point(self, points):
diff --git a/polliwog/segment/segment.py b/polliwog/segment/segment.py
index 49ddb24..ef6600f 100644
--- a/polliwog/segment/segment.py
+++ b/polliwog/segment/segment.py
@@ -69,40 +69,6 @@ def partition_segment(p1, p2, n_samples, endpoint=True):
     ] + p1
 
 
-def partition_segment_old(p1, p2, partition_size=5):
-    """
-    Deprecated. Please use partition_segment.
-
-    For two points in n-space, return an np.ndarray of partition points at equal widths
-    determined by 'partition_size' on the interior of the segment determined by p1 & p2.
-
-    Accomplished by partitioning the segment into 'partition_size' sub-intervals.
-
-    Partition order is oriented from p1 to p2.
-
-    Args:
-        p1, p2:
-            1 x N vectors
-
-        partition_size:
-            size of partition. should be > 1.
-    """
-
-    if not isinstance(partition_size, int):
-        raise TypeError("partition_size should be an int.")
-    elif partition_size < 2:
-        raise ValueError("partition_size should be bigger than 1.")
-
-    dist = np.linalg.norm(p1 - p2)
-
-    unit_direction = (p2 - p1) / dist
-    partition_width = dist / partition_size
-
-    domain = partition_width * np.arange(1, partition_size)
-
-    return p1 + unit_direction * domain[:, np.newaxis]
-
-
 def closest_point_of_line_segment(points, start_points, segment_vectors):
     # Adapted from public domain algorithm
     # https://gdbooks.gitbooks.io/3dcollisions/content/Chapter1/closest_point_on_line.html


Test patch:
diff --git a/polliwog/plane/test_plane.py b/polliwog/plane/test_plane.py
index 79a8269..4c4ae95 100644
--- a/polliwog/plane/test_plane.py
+++ b/polliwog/plane/test_plane.py
@@ -51,6 +51,7 @@ def test_returns_unsigned_distances_for_xz_plane_at_origin():
     expected = np.array([502.0, 501.0])
 
     np.testing.assert_array_equal(expected, plane.distance(pts))
+    np.testing.assert_array_equal(expected[0], plane.distance(pts[0]))
 
 
 def test_returns_signed_distances_for_diagonal_plane():
@@ -103,10 +104,9 @@ def test_returns_sign_for_diagonal_plane():
 
     pts = np.array([[425.0, 425.0, 25.0], [-500.0, -500.0, 25.0]])
 
-    sign = plane.sign(pts)
-
     expected = np.array([1.0, -1.0])
-    np.testing.assert_array_equal(sign, expected)
+    np.testing.assert_array_equal(plane.sign(pts), expected)
+    np.testing.assert_array_equal(plane.sign(pts[0]), expected[0])
 
 
 def test_points_in_front():
diff --git a/polliwog/segment/test_segment.py b/polliwog/segment/test_segment.py
index efe231e..5a8e17f 100644
--- a/polliwog/segment/test_segment.py
+++ b/polliwog/segment/test_segment.py
@@ -4,99 +4,9 @@ from .segment import (
     closest_point_of_line_segment,
     partition,
     partition_segment,
-    partition_segment_old,
 )
 
 
-def test_partition_segment_old_raises_exception_for_invalid_partition_size_type():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([1.0, 0.0, 0.0])
-
-    with pytest.raises(TypeError):
-        partition_segment_old(p1, p2, "foobar")
-
-
-def test_partition_segment_old_raises_exception_for_invalid_partition_size_value():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([1.0, 0.0, 0.0])
-
-    with pytest.raises(ValueError):
-        partition_segment_old(p1, p2, 1)
-
-
-def test_partition_segment_old_returns_partition_for_odd_partition_size():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([2.0, 0.0, 0.0])
-
-    partition_size = 4
-
-    expected_partition_points = np.array(
-        [[0.5, 0.0, 0.0], [1.0, 0.0, 0.0], [1.5, 0.0, 0.0]]
-    )
-
-    np.testing.assert_array_almost_equal(
-        partition_segment_old(p1, p2, partition_size),
-        expected_partition_points,
-        decimal=7,
-    )
-
-
-def test_partition_segment_old_returns_partition_points_for_even_partition_size():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([1.0, 0.0, 0.0])
-
-    partition_size = 5
-
-    expected_partition_points = np.array(
-        [[0.2, 0.0, 0.0], [0.4, 0.0, 0.0], [0.6, 0.0, 0.0], [0.8, 0.0, 0.0]]
-    )
-
-    np.testing.assert_array_almost_equal(
-        partition_segment_old(p1, p2, partition_size),
-        expected_partition_points,
-        decimal=7,
-    )
-
-
-def test_partition_segment_old_returns_partition_points_in_oriented_order():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([1.0, 0.0, 0.0])
-
-    partition_size = 5
-
-    expected_partition_points = np.array(
-        [[0.8, 0.0, 0.0], [0.6, 0.0, 0.0], [0.4, 0.0, 0.0], [0.2, 0.0, 0.0]]
-    )
-
-    np.testing.assert_array_almost_equal(
-        partition_segment_old(p2, p1, partition_size),
-        expected_partition_points,
-        decimal=7,
-    )
-
-
-def test_partition_segment_old_returns_partition_points_for_diagonal_segment():
-    p1 = np.array([0.0, 0.0, 0.0])
-    p2 = np.array([1.0, 1.0, 0.0])
-
-    partition_size = 3
-
-    dist = np.linalg.norm(p2 - p1)
-    domain = [(1 / 3.0) * dist, (2 / 3.0) * dist]
-
-    unit_direction = (p2 - p1) / dist
-
-    expected_partition_points = np.array(
-        [p1 + scalar * unit_direction for scalar in domain]
-    )
-
-    np.testing.assert_array_almost_equal(
-        partition_segment_old(p1, p2, partition_size),
-        expected_partition_points,
-        decimal=7,
-    )
-
-
 def test_partition_segment_raises_exception_for_invalid_partition_size_type():
     p1 = np.array([0.0, 0.0, 0.0])
     p2 = np.array([1.0, 0.0, 0.0])