Repository: lace/polliwog

Issue:
Remove mentions of Lace in the documentation

Discussion:

Patch:
diff --git a/polliwog/line/__init__.py b/polliwog/line/__init__.py
index fd46546..6c4309a 100644
--- a/polliwog/line/__init__.py
+++ b/polliwog/line/__init__.py
@@ -1,5 +1,5 @@
 from . import functions as _functions
 from .functions import *  # noqa: F401,F403
-from .line_intersect import line_intersect2, line_intersect3
+from .line_intersect import intersect_2d_lines, intersect_lines  # noqa: F401
 
-__all__ = _functions.__all__ + ["line_intersect2", "line_intersect3"]
+__all__ = ["intersect_lines", "intersect_2d_lines"] + _functions.__all__
diff --git a/polliwog/line/functions.py b/polliwog/line/functions.py
index 89ac4e4..9ea02a6 100644
--- a/polliwog/line/functions.py
+++ b/polliwog/line/functions.py
@@ -1,10 +1,10 @@
 import vg
 from .._common.shape import check_shape_any
 
-__all__ = ["project_to_line"]
+__all__ = ["project_point_to_line", "coplanar_points_are_on_same_side_of_line"]
 
 
-def project_to_line(points, reference_points_of_lines, vectors_along_lines):
+def project_point_to_line(points, reference_points_of_lines, vectors_along_lines):
     """
     Project a point to a line, or pairwise project a stack of points to a
     stack of lines.
@@ -21,3 +21,27 @@ def project_to_line(points, reference_points_of_lines, vectors_along_lines):
     return reference_points_of_lines + vg.project(
         points - reference_points_of_lines, onto=vectors_along_lines
     )
+
+
+def coplanar_points_are_on_same_side_of_line(a, b, p1, p2):
+    """
+    Test if the given points are on the same side of the given line.
+
+    Args:
+        a (np.arraylike): The first 3D point of interest.
+        b (np.arraylike): The second 3D point of interest.
+        p1 (np.arraylike): A first point which lies on the line of interest.
+        p2 (np.arraylike): A second point which lies on the line of interest.
+
+    Returns:
+        bool: `True` when `a` and `b` are on the same side of the line defined
+        by `p1` and `p2`.
+    """
+    vg.shape.check(locals(), "a", (3,))
+    vg.shape.check(locals(), "b", (3,))
+    vg.shape.check(locals(), "p1", (3,))
+    vg.shape.check(locals(), "p2", (3,))
+
+    # Uses "same-side technique" from http://blackpawn.com/texts/pointinpoly/default.html
+    along_line = b - a
+    return vg.dot(vg.cross(along_line, p1 - a), vg.cross(along_line, p2 - a)) >= 0
diff --git a/polliwog/line/line.py b/polliwog/line/line.py
index 0e51a76..b860c10 100644
--- a/polliwog/line/line.py
+++ b/polliwog/line/line.py
@@ -1,6 +1,4 @@
-from __future__ import absolute_import, print_function
 import vg
-from .functions import project_to_line
 
 
 class Line:
@@ -32,15 +30,17 @@ class Line:
         """
         Find the intersection with another line.
         """
-        from .line_intersect import line_intersect3
+        from .line_intersect import intersect_lines
 
-        return line_intersect3(*(self.reference_points + other.reference_points))
+        return intersect_lines(*(self.reference_points + other.reference_points))
 
     def project(self, points):
         """
         Project a given point (or stack of points) to the plane.
         """
-        return project_to_line(
+        from .functions import project_point_to_line
+
+        return project_point_to_line(
             points=points,
             reference_points_of_lines=self.reference_point,
             vectors_along_lines=self.along,
diff --git a/polliwog/line/line_intersect.py b/polliwog/line/line_intersect.py
index 206ff56..61ae357 100644
--- a/polliwog/line/line_intersect.py
+++ b/polliwog/line/line_intersect.py
@@ -1,32 +1,7 @@
 import numpy as np
 
 
-def line_intersect2(p0, q0, p1, q1):
-    """
-    Intersect two lines: (p0, q0) and (p1, q1). Each should be a 2D
-    point.
-    """
-    # Adapted from http://stackoverflow.com/a/26416320/893113
-    dy = q0[1] - p0[1]
-    dx = q0[0] - p0[0]
-    lhs0 = [-dy, dx]
-    rhs0 = p0[1] * dx - dy * p0[0]
-
-    dy = q1[1] - p1[1]
-    dx = q1[0] - p1[0]
-    lhs1 = [-dy, dx]
-    rhs1 = p1[1] * dx - dy * p1[0]
-
-    a = np.array([lhs0, lhs1])
-    b = np.array([rhs0, rhs1])
-
-    try:
-        return np.linalg.solve(a, b)
-    except np.linalg.LinAlgError:
-        return None
-
-
-def line_intersect3(p0, q0, p1, q1):
+def intersect_lines(p0, q0, p1, q1):
     """
     Intersect two lines in 3d: (p0, q0) and (p1, q1). Each should be a 3D
     point.
@@ -55,3 +30,28 @@ def line_intersect3(p0, q0, p1, q1):
     l = h_ / k_ * e  # noqa: E741 (FIXME)
     sign = -1 if np.all(h / h_ == k / k_) else +1
     return p0 + sign * l
+
+
+def intersect_2d_lines(p0, q0, p1, q1):
+    """
+    Intersect two lines: (p0, q0) and (p1, q1). Each should be a 2D
+    point.
+    """
+    # Adapted from http://stackoverflow.com/a/26416320/893113
+    dy = q0[1] - p0[1]
+    dx = q0[0] - p0[0]
+    lhs0 = [-dy, dx]
+    rhs0 = p0[1] * dx - dy * p0[0]
+
+    dy = q1[1] - p1[1]
+    dx = q1[0] - p1[0]
+    lhs1 = [-dy, dx]
+    rhs1 = p1[1] * dx - dy * p1[0]
+
+    a = np.array([lhs0, lhs1])
+    b = np.array([rhs0, rhs1])
+
+    try:
+        return np.linalg.solve(a, b)
+    except np.linalg.LinAlgError:
+        return None
diff --git a/polliwog/polyline/polyline.py b/polliwog/polyline/polyline.py
index 281ece7..2f79230 100644
--- a/polliwog/polyline/polyline.py
+++ b/polliwog/polyline/polyline.py
@@ -4,18 +4,15 @@ import vg
 
 class Polyline(object):
     """
-    Represent the geometry of a polygonal chain in 3-space. The
-    chain may be open or closed, and there are no constraints on the
-    geometry. For example, the chain may be simple or
-    self-intersecting, and the points need not be unique.
+    Represent the geometry of a polygonal chain in 3-space. The chain may be
+    open or closed.
 
-    Mutable by setting polyline.v or polyline.closed or calling
-    a method like polyline.partition_by_length().
-
-    Note this class is distinct from lace.lines.Lines, which
-    allows arbitrary edges and enables visualization. To convert to
-    a Lines object, use the as_lines() method.
+    There are no constraints on the geometry. For example, the chain may be
+    simple or self-intersecting, and the points need not be unique.
 
+    The methods do not mutate; they create new polylines which exhibit the
+    requested mutation. However, immutability is not enforced. If you wish
+    you can mutate a polyline by updating `polyline.v` or `polyline.is_closed`.
     """
 
     def __init__(self, v, is_closed=False):
@@ -299,7 +296,7 @@ class Polyline(object):
 
         """
         import itertools
-        from ..segment.segment_functions import partition_segment
+        from ..segment.segment_functions import subdivide_segment
 
         old_num_e = self.num_e
         old_num_v = self.num_v
@@ -308,7 +305,7 @@ class Polyline(object):
         )
         (es_to_subdivide,) = (num_segments_needed > 1).nonzero()
         vs_to_insert = [
-            partition_segment(
+            subdivide_segment(
                 self.v[self.e[old_e_index][0]],
                 self.v[self.e[old_e_index][1]],
                 np.int(num_segments_needed[old_e_index]),
diff --git a/polliwog/segment/__init__.py b/polliwog/segment/__init__.py
index c31c526..4456e19 100644
--- a/polliwog/segment/__init__.py
+++ b/polliwog/segment/__init__.py
@@ -1,7 +1,7 @@
 from .segment_functions import (
     closest_point_of_line_segment,
-    partition,
-    partition_segment,
+    subdivide_segment,
+    subdivide_segments,
 )
 
-__all__ = ["closest_point_of_line_segment", "partition", "partition_segment"]
+__all__ = ["closest_point_of_line_segment", "subdivide_segment", "subdivide_segments"]
diff --git a/polliwog/segment/segment_functions.py b/polliwog/segment/segment_functions.py
index ef6600f..a185231 100644
--- a/polliwog/segment/segment_functions.py
+++ b/polliwog/segment/segment_functions.py
@@ -2,7 +2,37 @@ import numpy as np
 import vg
 
 
-def partition(v, partition_size=5):
+def subdivide_segment(p1, p2, num_points, endpoint=True):
+    """
+    For two points in n-space, return an np.ndarray of equidistant partition
+    points along the segment determined by p1 & p2.
+
+    The total number of points returned will be n_samples. When n_samples is
+    2, returns the original points.
+
+    When endpoint is True, p2 is the last point. When false, p2 is excluded.
+
+    Partition order is oriented from p1 to p2.
+
+    Args:
+        p1, p2:
+            1 x N vectors
+
+        partition_size:
+            size of partition. should be >= 2.
+
+    """
+    if not isinstance(num_points, int):
+        raise TypeError("partition_size should be an int.")
+    elif num_points < 2:
+        raise ValueError("partition_size should be bigger than 1.")
+
+    return (p2 - p1) * np.linspace(0, 1, num=num_points, endpoint=endpoint)[
+        :, np.newaxis
+    ] + p1
+
+
+def subdivide_segments(v, num_subdivisions=5):
     """
 
     params:
@@ -26,50 +56,24 @@ def partition(v, partition_size=5):
     dists = np.sqrt(np.sum(sqdis, axis=1))
 
     unitds = diffs / dists[:, np.newaxis]
-    widths = dists / partition_size
+    widths = dists / num_subdivisions
 
-    domain = widths[:, np.newaxis] * np.arange(0, partition_size)
+    domain = widths[:, np.newaxis] * np.arange(0, num_subdivisions)
     domain = domain.flatten()[:, np.newaxis]
 
-    points = np.repeat(v[:-1], partition_size, axis=0)
-    unitds = np.repeat(unitds, partition_size, axis=0)
+    points = np.repeat(v[:-1], num_subdivisions, axis=0)
+    unitds = np.repeat(unitds, num_subdivisions, axis=0)
 
     filled = points + (unitds * domain)
 
     return np.vstack((filled, v[-1]))
 
 
-def partition_segment(p1, p2, n_samples, endpoint=True):
+def closest_point_of_line_segment(points, start_points, segment_vectors):
     """
-    For two points in n-space, return an np.ndarray of equidistant partition
-    points along the segment determined by p1 & p2.
-
-    The total number of points returned will be n_samples. When n_samples is
-    2, returns the original points.
-
-    When endpoint is True, p2 is the last point. When false, p2 is excluded.
-
-    Partition order is oriented from p1 to p2.
-
-    Args:
-        p1, p2:
-            1 x N vectors
-
-        partition_size:
-            size of partition. should be >= 2.
-
+    Compute pairwise the point on each line segment that is nearest to the
+    corresponding query point.
     """
-    if not isinstance(n_samples, int):
-        raise TypeError("partition_size should be an int.")
-    elif n_samples < 2:
-        raise ValueError("partition_size should be bigger than 1.")
-
-    return (p2 - p1) * np.linspace(0, 1, num=n_samples, endpoint=endpoint)[
-        :, np.newaxis
-    ] + p1
-
-
-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
     k = vg.shape.check(locals(), "points", (-1, 3))
diff --git a/polliwog/tri/functions.py b/polliwog/tri/functions.py
index 387221d..5040803 100644
--- a/polliwog/tri/functions.py
+++ b/polliwog/tri/functions.py
@@ -1,11 +1,11 @@
 import numpy as np
 import vg
 from .._common.shape import columnize
+from ..line.functions import coplanar_points_are_on_same_side_of_line
 
 __all__ = [
     "surface_normals",
-    "coplanar_points_are_on_same_side_of_line",
-    "contains_coplanar_point",
+    "tri_contains_coplanar_point",
     "barycentric_coordinates_of_points",
 ]
 
@@ -33,31 +33,7 @@ def surface_normals(points, normalize=True):
     return transform_result(normals)
 
 
-def coplanar_points_are_on_same_side_of_line(a, b, p1, p2):
-    """
-    Test if the given points are on the same side of the given line.
-
-    Args:
-        a (np.arraylike): The first 3D point of interest.
-        b (np.arraylike): The second 3D point of interest.
-        p1 (np.arraylike): A first point which lies on the line of interest.
-        p2 (np.arraylike): A second point which lies on the line of interest.
-
-    Returns:
-        bool: `True` when `a` and `b` are on the same side of the line defined
-        by `p1` and `p2`.
-    """
-    vg.shape.check(locals(), "a", (3,))
-    vg.shape.check(locals(), "b", (3,))
-    vg.shape.check(locals(), "p1", (3,))
-    vg.shape.check(locals(), "p2", (3,))
-
-    # Uses "same-side technique" from http://blackpawn.com/texts/pointinpoly/default.html
-    along_line = b - a
-    return vg.dot(vg.cross(along_line, p1 - a), vg.cross(along_line, p2 - a)) >= 0
-
-
-def contains_coplanar_point(a, b, c, point):
+def tri_contains_coplanar_point(a, b, c, point):
     """
     Assuming `point` is coplanar with the triangle `ABC`, check if it lies
     inside it.


Test patch:
diff --git a/polliwog/line/test_functions.py b/polliwog/line/test_functions.py
index 5a440f5..2fe7356 100644
--- a/polliwog/line/test_functions.py
+++ b/polliwog/line/test_functions.py
@@ -1,9 +1,9 @@
 import numpy as np
 import vg
-from .functions import project_to_line
+from .functions import project_point_to_line
 
 
-def test_project_to_line():
+def test_project_point_to_line():
     p1 = np.array([5.0, 5.0, 4.0])
     p2 = np.array([10.0, 10.0, 6.0])
     along_line = p2 - p1
@@ -11,15 +11,15 @@ def test_project_to_line():
     common_kwargs = dict(reference_points_of_lines=p1, vectors_along_lines=along_line)
 
     np.testing.assert_array_almost_equal(
-        project_to_line(points=p1, **common_kwargs), p1
+        project_point_to_line(points=p1, **common_kwargs), p1
     )
     np.testing.assert_array_almost_equal(
-        project_to_line(points=p2, **common_kwargs), p2
+        project_point_to_line(points=p2, **common_kwargs), p2
     )
 
     other_point_on_line = np.array([0.0, 0.0, 2.0])
     np.testing.assert_array_almost_equal(
-        project_to_line(points=other_point_on_line, **common_kwargs),
+        project_point_to_line(points=other_point_on_line, **common_kwargs),
         other_point_on_line,
     )
 
@@ -30,12 +30,14 @@ def test_project_to_line():
     for point_on_line in [p1, p2, other_point_on_line]:
         for displacement in example_perpendicular_displacement:
             np.testing.assert_array_almost_equal(
-                project_to_line(points=point_on_line + displacement, **common_kwargs),
+                project_point_to_line(
+                    points=point_on_line + displacement, **common_kwargs
+                ),
                 point_on_line,
             )
 
 
-def test_project_to_line_stacked_points():
+def test_project_point_to_line_stacked_points():
     p1 = np.array([5.0, 5.0, 4.0])
     p2 = np.array([10.0, 10.0, 6.0])
     along_line = p2 - p1
@@ -53,18 +55,18 @@ def test_project_to_line_stacked_points():
     expected_projected_points = np.vstack([p1, p2, other_point_on_line])
 
     np.testing.assert_array_almost_equal(
-        project_to_line(points=example_points, **common_kwargs),
+        project_point_to_line(points=example_points, **common_kwargs),
         expected_projected_points,
     )
     np.testing.assert_array_almost_equal(
-        project_to_line(
+        project_point_to_line(
             points=example_points + example_perpendicular_displacement, **common_kwargs
         ),
         expected_projected_points,
     )
 
 
-def test_project_to_line_stacked_lines():
+def test_project_point_to_line_stacked_lines():
     p1 = np.array([5.0, 5.0, 4.0])
     p2 = np.array([10.0, 10.0, 6.0])
     along_line = p2 - p1
@@ -76,7 +78,7 @@ def test_project_to_line_stacked_lines():
 
     other_point_on_line = np.array([0.0, 0.0, 2.0])
     np.testing.assert_array_almost_equal(
-        project_to_line(points=other_point_on_line, **common_kwargs),
+        project_point_to_line(points=other_point_on_line, **common_kwargs),
         np.array([other_point_on_line, other_point_on_line]),
     )
 
@@ -87,12 +89,14 @@ def test_project_to_line_stacked_lines():
     for point_on_line in [p1, p2, other_point_on_line]:
         for displacement in example_perpendicular_displacement:
             np.testing.assert_array_almost_equal(
-                project_to_line(points=point_on_line + displacement, **common_kwargs),
+                project_point_to_line(
+                    points=point_on_line + displacement, **common_kwargs
+                ),
                 np.array([point_on_line, point_on_line]),
             )
 
 
-def test_project_to_line_stacked_both():
+def test_project_point_to_line_stacked_both():
     p1 = np.array([5.0, 5.0, 4.0])
     p2 = np.array([10.0, 10.0, 6.0])
     along_line = p2 - p1
@@ -113,11 +117,11 @@ def test_project_to_line_stacked_both():
     expected_projected_points = np.vstack([p1, p2, other_point_on_line])
 
     np.testing.assert_array_almost_equal(
-        project_to_line(points=example_points, **common_kwargs),
+        project_point_to_line(points=example_points, **common_kwargs),
         expected_projected_points,
     )
     np.testing.assert_array_almost_equal(
-        project_to_line(
+        project_point_to_line(
             points=example_points + example_perpendicular_displacement, **common_kwargs
         ),
         expected_projected_points,
diff --git a/polliwog/line/test_line_intersect.py b/polliwog/line/test_line_intersect.py
index a31af76..02cec73 100644
--- a/polliwog/line/test_line_intersect.py
+++ b/polliwog/line/test_line_intersect.py
@@ -1,82 +1,82 @@
 import numpy as np
-from .line_intersect import line_intersect2, line_intersect3
+from .line_intersect import intersect_2d_lines, intersect_lines
 
 
-def test_line_intersect2():
+def test_intersect_2d_lines():
     p0, q0 = np.array([[0.0, 3.0], [4.0, 11.0]])
     p1, q1 = np.array([[-2.0, 8.0], [6.0, 4.0]])
-    np.testing.assert_array_equal(line_intersect2(p0, q0, p1, q1), [1.6, 6.2])
+    np.testing.assert_array_equal(intersect_2d_lines(p0, q0, p1, q1), [1.6, 6.2])
 
 
-def test_line_intersect2_duplicate_point():
+def test_intersect_2d_lines_duplicate_point():
     p0, q0 = np.array([[0.0, 3.0], [5.0, 5.0]])
     p1, q1 = np.array([[5.0, 5.0], [6.0, 4.0]])
-    np.testing.assert_array_equal(line_intersect2(p0, q0, p1, q1), [5.0, 5.0])
+    np.testing.assert_array_equal(intersect_2d_lines(p0, q0, p1, q1), [5.0, 5.0])
 
 
-def test_line_intersect2_with_collinear_lines():
+def test_intersect_2d_lines_with_collinear_lines():
     p0, q0 = np.array([[0.0, 1.0], [0.0, 10.0]])
     p1, q1 = np.array([[0.0, 2.0], [0.0, 4.0]])
-    assert line_intersect2(p0, q0, p1, q1) is None
+    assert intersect_2d_lines(p0, q0, p1, q1) is None
 
 
-def test_line_intersect2_with_parallel_lines():
+def test_intersect_2d_lines_with_parallel_lines():
     p0, q0 = np.array([[0.0, 1.0], [0.0, 10.0]])
     p1, q1 = np.array([[1.0, 2.0], [1.0, 11.0]])
-    assert line_intersect2(p0, q0, p1, q1) is None
+    assert intersect_2d_lines(p0, q0, p1, q1) is None
 
 
-def test_line_intersect3_with_collinear_lines():
+def test_intersect_lines_with_collinear_lines():
     p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
     p1, q1 = np.array([[0.0, 2.0, 4.0], [0.0, 4.0, 8.0]])
-    assert line_intersect3(p0, q0, p1, q1) is None
+    assert intersect_lines(p0, q0, p1, q1) is None
 
 
-def test_line_intersect3_with_parallel_lines():
+def test_intersect_lines_with_parallel_lines():
     p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
     p1, q1 = np.array([[1.0, 2.0, 3.0], [1.0, 11.0, 21.0]])
-    assert line_intersect3(p0, q0, p1, q1) is None
+    assert intersect_lines(p0, q0, p1, q1) is None
 
 
-def test_line_intersect3_with_degenerate_input_p():
+def test_intersect_lines_with_degenerate_input_p():
     p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
     p1, q1 = np.array([[0.0, 1.0, 2.0], [1.0, 11.0, 21.0]])
-    np.testing.assert_array_equal(line_intersect3(p0, q0, p1, q1), [0.0, 1.0, 2.0])
+    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1), [0.0, 1.0, 2.0])
 
 
-def test_line_intersect3_with_degenerate_input_q():
+def test_intersect_lines_with_degenerate_input_q():
     p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
     p1, q1 = np.array([[1.0, 2.0, 3.0], [0.0, 10.0, 20.0]])
-    np.testing.assert_array_equal(line_intersect3(p0, q0, p1, q1), [0.0, 10.0, 20.0])
+    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1), [0.0, 10.0, 20.0])
 
 
-def test_line_intersect3_with_degenerate_input_q_2():
+def test_intersect_lines_with_degenerate_input_q_2():
     p0, q0 = np.array([[0.0, 1.0, 2.0], [0.0, 10.0, 20.0]])
     p1, q1 = np.array([[0.0, 10.0, 20.0], [1.0, 2.0, 3.0]])
-    np.testing.assert_array_equal(line_intersect3(p0, q0, p1, q1), [0.0, 10.0, 20.0])
+    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1), [0.0, 10.0, 20.0])
 
 
-def test_line_intersect3_example_1():
+def test_intersect_lines_example_1():
     """
     This example tests the codirectional cross product case.
     """
     p0, q0 = np.array([[5.0, 5.0, 4.0], [10.0, 10.0, 6.0]])
     p1, q1 = np.array([[5.0, 5.0, 5.0], [10.0, 10.0, 3.0]])
     np.testing.assert_array_equal(
-        line_intersect3(p0, q0, p1, q1), [25.0 / 4, 25.0 / 4, 9.0 / 2]
+        intersect_lines(p0, q0, p1, q1), [25.0 / 4, 25.0 / 4, 9.0 / 2]
     )
 
 
-def test_line_intersect3_example_2():
+def test_intersect_lines_example_2():
     """
     This example tests the opposite direction cross product case.
     """
     p0, q0 = np.array([[5.0, 5.0, 4.0], [10.0, 10.0, -6.0]])
     p1, q1 = np.array([[5.0, 5.0, 5.0], [10.0, 10.0, -3.0]])
-    np.testing.assert_array_equal(line_intersect3(p0, q0, p1, q1), [2.5, 2.5, 9])
+    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1), [2.5, 2.5, 9])
 
 
-def test_line_intersect3_example_3():
+def test_intersect_lines_example_3():
     p0, q0 = np.array([[6.0, 8.0, 4.0], [12.0, 15.0, 4.0]])
     p1, q1 = np.array([[6.0, 8.0, 2.0], [12.0, 15.0, 6.0]])
-    np.testing.assert_array_equal(line_intersect3(p0, q0, p1, q1), [9.0, 23.0 / 2, 4.0])
+    np.testing.assert_array_equal(intersect_lines(p0, q0, p1, q1), [9.0, 23.0 / 2, 4.0])
diff --git a/polliwog/segment/test_segment_functions.py b/polliwog/segment/test_segment_functions.py
index aa61365..e324ad5 100644
--- a/polliwog/segment/test_segment_functions.py
+++ b/polliwog/segment/test_segment_functions.py
@@ -2,28 +2,28 @@ import numpy as np
 import pytest
 from .segment_functions import (
     closest_point_of_line_segment,
-    partition,
-    partition_segment,
+    subdivide_segment,
+    subdivide_segments,
 )
 
 
-def test_partition_segment_raises_exception_for_invalid_partition_size_type():
+def test_subdivide_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])
 
     with pytest.raises(TypeError):
-        partition_segment(p1, p2, "foobar")
+        subdivide_segment(p1, p2, "foobar")
 
 
-def test_partition_segment_raises_exception_for_invalid_partition_size_value():
+def test_subdivide_segment_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(p1, p2, 1)
+        subdivide_segment(p1, p2, 1)
 
 
-def test_partition_segment_returns_partition_for_odd_partition_size():
+def test_subdivide_segment_returns_partition_for_odd_partition_size():
     p1 = np.array([0.0, 0.0, 0.0])
     p2 = np.array([2.0, 0.0, 0.0])
 
@@ -40,11 +40,11 @@ def test_partition_segment_returns_partition_for_odd_partition_size():
     )
 
     np.testing.assert_array_almost_equal(
-        partition_segment(p1, p2, partition_size), expected_partition_points, decimal=7
+        subdivide_segment(p1, p2, partition_size), expected_partition_points, decimal=7
     )
 
 
-def test_partition_segment_returns_partition_points_for_even_partition_size():
+def test_subdivide_segment_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])
 
@@ -62,11 +62,11 @@ def test_partition_segment_returns_partition_points_for_even_partition_size():
     )
 
     np.testing.assert_array_almost_equal(
-        partition_segment(p1, p2, partition_size), expected_partition_points, decimal=7
+        subdivide_segment(p1, p2, partition_size), expected_partition_points, decimal=7
     )
 
 
-def test_partition_segment_returns_partition_omitting_endpoint():
+def test_subdivide_segment_returns_partition_omitting_endpoint():
     p1 = np.array([0.0, 0.0, 0.0])
     p2 = np.array([1.0, 0.0, 0.0])
 
@@ -83,13 +83,13 @@ def test_partition_segment_returns_partition_omitting_endpoint():
     )
 
     np.testing.assert_array_almost_equal(
-        partition_segment(p1, p2, partition_size, endpoint=False),
+        subdivide_segment(p1, p2, partition_size, endpoint=False),
         expected_partition_points,
         decimal=7,
     )
 
 
-def test_partition_adds_points_for_equal_length_line_segments():
+def test_subdivide_segments_adds_points_for_equal_length_line_segments():
     v = np.array(
         [
             [0.0, 0.0, 0.0],
@@ -126,10 +126,10 @@ def test_partition_adds_points_for_equal_length_line_segments():
         ]
     )
 
-    np.testing.assert_array_almost_equal(partition(v), expected)
+    np.testing.assert_array_almost_equal(subdivide_segments(v), expected)
 
 
-def test_partition_adds_points_for_nonequal_arbitrarily_oriented_line():
+def test_subdivide_segments_adds_points_for_nonequal_arbitrarily_oriented_line():
     v = np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 1.0], [2.0, 0.0, 1.0], [2.0, 2.0, 1.0]])
 
     expected = np.array(
@@ -153,7 +153,7 @@ def test_partition_adds_points_for_nonequal_arbitrarily_oriented_line():
         ]
     )
 
-    np.testing.assert_array_almost_equal(partition(v), expected)
+    np.testing.assert_array_almost_equal(subdivide_segments(v), expected)
 
 
 def test_closest_point_of_line_segment():
diff --git a/polliwog/tri/test_functions.py b/polliwog/tri/test_functions.py
index 48c87da..74337ca 100644
--- a/polliwog/tri/test_functions.py
+++ b/polliwog/tri/test_functions.py
@@ -3,8 +3,8 @@ import numpy as np
 import vg
 from .functions import (
     barycentric_coordinates_of_points,
-    contains_coplanar_point,
     surface_normals,
+    tri_contains_coplanar_point,
 )
 
 
@@ -46,34 +46,34 @@ def test_surface_normals_from_points_vectorized():
     np.testing.assert_allclose(surface_normals(vertices), expected_normals)
 
 
-def test_contains_coplanar_point():
+def test_tri_contains_coplanar_point():
     a = np.array([0.0, 0.0, 0.0])
     b = np.array([4.0, 0.1, 0.0])
     c = np.array([3.0, 3.1, 0.0])
 
     # Not sure why, but `is True` does not work.
-    assert contains_coplanar_point(a, b, c, a) == True  # noqa: E712
-    assert contains_coplanar_point(a, b, c, b) == True  # noqa: E712
-    assert contains_coplanar_point(a, b, c, c) == True  # noqa: E712
+    assert tri_contains_coplanar_point(a, b, c, a) == True  # noqa: E712
+    assert tri_contains_coplanar_point(a, b, c, b) == True  # noqa: E712
+    assert tri_contains_coplanar_point(a, b, c, c) == True  # noqa: E712
     assert (
-        contains_coplanar_point(a, b, c, np.array([2.0, 1.0, 0.0])) == True
+        tri_contains_coplanar_point(a, b, c, np.array([2.0, 1.0, 0.0])) == True
     )  # noqa: E712
 
     # Unexpected, as it's not in the plane, though if projected to the plane,
     # it is in the triangle.
     assert (
-        contains_coplanar_point(a, b, c, np.array([0.0, 0.0, 1.0])) == True
+        tri_contains_coplanar_point(a, b, c, np.array([0.0, 0.0, 1.0])) == True
     )  # noqa: E712
 
     assert (
-        contains_coplanar_point(a, b, c, np.array([2.0, 0.0, 0.0])) == False
+        tri_contains_coplanar_point(a, b, c, np.array([2.0, 0.0, 0.0])) == False
     )  # noqa: E712
     assert (
-        contains_coplanar_point(a, b, c, np.array([2.0, 5.0, 0.0])) == False
+        tri_contains_coplanar_point(a, b, c, np.array([2.0, 5.0, 0.0])) == False
     )  # noqa: E712
 
     assert (
-        contains_coplanar_point(
+        tri_contains_coplanar_point(
             np.array([0.06710189, 1.69908346, 0.06590126]),
             np.array([0.05648619, 1.70207, 0.07402092]),
             np.array([0.05969098, 1.69641423, 0.07268801]),