Skip to content

finding centerline without spikes #50

@Golbstein

Description

@Golbstein
outer = Polygon([
    (10, 0), (7.07, 7.07), (0, 10), (-7.07, 7.07), (-10, 0), 
    (-7.07, -7.07), (0, -10), (7.07, -7.07), (10, 0)
])
inner = Polygon([
    (5, 0), (3.54, 3.54), (0, 5), (-3.54, 3.54), (-5, 0), 
    (-3.54, -3.54), (0, -5), (3.54, -3.54), (5, 0)
])
ring = Polygon(outer.exterior.coords, [inner.exterior.coords])

from centerline.geometry import Centerline
centerline = Centerline(ring)
for p in centerline.geometry.geoms:
    plt.plot(*p.xy)

plt.plot(*ring.exterior.xy, color='r')
plt.plot(*ring.interiors[0].xy, color='r')

Image

is there a way to get the inner circle only without post-processing (removing lines that are too close to the boundaries)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions