Medial Axis

medial axes

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

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)

One Response to “Medial Axis”
Check out what others are saying...
  1. […] 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 […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: