Files
fotoplaner/venv/lib/python3.12/site-packages/shapely/tests/legacy/test_delaunay.py
T
anders 16c54c6653 Tilføjet venv med docling og afhængigheder
Testfiler opdelt i PNG og previews
2026-10-27 12:20:23 +01:00

33 lines
838 B
Python

import unittest
from shapely.geometry import LineString, Point, Polygon
from shapely.ops import triangulate
class DelaunayTriangulation(unittest.TestCase):
"""
Only testing the number of triangles and their type here.
This doesn't actually test the points in the resulting geometries.
"""
def setUp(self):
self.p = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])
def test_polys(self):
polys = triangulate(self.p)
assert len(polys) == 2
for p in polys:
assert isinstance(p, Polygon)
def test_lines(self):
polys = triangulate(self.p, edges=True)
assert len(polys) == 5
for p in polys:
assert isinstance(p, LineString)
def test_point(self):
p = Point(1, 1)
polys = triangulate(p)
assert len(polys) == 0