Skip to content

Commit

Permalink
check triangles touch
Browse files Browse the repository at this point in the history
  • Loading branch information
rhayes777 committed Nov 11, 2024
1 parent 00886ff commit 99ab78c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AbstractCoordinateArray(ABC):
def __init__(
self,
coordinates: np.ndarray,
side_length: float,
side_length: float = 1.0,
x_offset: float = 0.0,
y_offset: float = 0.0,
flipped: bool = False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,16 @@ def test_means(one_triangle):
)
def test_containment(one_triangle, x, y):
assert one_triangle.containing_indices(Point(x, y)) == [0]


def test_triangles_touch():
triangles = CoordinateArrayTriangles(
np.array([[0, 0], [2, 0]]),
)

assert max(triangles.triangles[0][:, 0]) == min(triangles.triangles[1][:, 0])

triangles = CoordinateArrayTriangles(
np.array([[0, 0], [0, 1]]),
)
assert max(triangles.triangles[0][:, 1]) == min(triangles.triangles[1][:, 1])

0 comments on commit 99ab78c

Please sign in to comment.