In [1]:
%pylab --no-import-all inline
from geo.generator import randomConvexPolygon, randomConcaveTiling
from geo.drawer import plot, plotPoints
from kirkpatrick import Locator
Populating the interactive namespace from numpy and matplotlib
In [2]:
# Create a random region
initial = randomConvexPolygon(100, k=100)
polygons = randomConcaveTiling(initial)
In [3]:
# Run Kirkpatrick's
locator = Locator(polygons)

# Visualize triangulated boundary
plot(locator.boundary, style='g--')
plot(locator.regions, style='g-')
In [9]:
# Locate a point
target = initial.smartInteriorPoint()
region = locator.locate(target)
plotPoints(target, style='bo')
plot(locator.regions, style='g-')
plot(region, style='ro-')
In [ ]: