### Medial Axis

*The medial axes and vanes of various shapes*

One of the first grasshopper definitions shared at Daniel Piker‘s SpaceSymmetryStructure blog was a file for calculating the medial axis (or topological skeleton) of a curve: the set of points with at least two closest points on a curve boundary. This definition was more accurately a voronoi skeleton, because it is composed from the edges of a voronoi diagram generated by subdivision of the boundary curve. At low resolutions this creates a jagged axis, but fewer segments.

Unfortunately, new releases of Grasshopper have made the original definition unusable (changes to the datastructure of intersection results have made the boolean pattern used to select the interior segments ineffective). This definition follows the same basic algorithm: check the segments of each voronoi cell for intersection; the segments with no intersection are either wholly on the interior or exterior; those on the interior compose the voronoi skeleton. Moving these steps inside a VB.NET script allows us to bypass many of the dataTree headaches. In addition, I’ve added a second output, the vanes extending from the axis to the perimeter, and removed the duplicate segments from the output.

*Grasshopper definition canvas*

(gh download)

UPDATE: per request a version which can compute the medial axis for shapes of Genus>0. The islands must be located in the same datapaths as the boundary curves and the Voronoi diagrams: (gh download)

## Comments

One Response to “Medial Axis”## Trackbacks

Check out what others are saying...[…] polygon’s straight skeleton resembles the voronoi skeleton or medial axis, but is composed of only straight segments (and typically fewer of them, a voronoi […]