Created
January 23, 2013 13:45
-
-
Save quommit/4605752 to your computer and use it in GitHub Desktop.
Pseudo-code for a medial axis transform algorithm based on Voronoi diagram.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get point cloud S from polygon P | |
//by running a densify operation | |
var S = P.Densify (); | |
//Create Voronoi diagram V for | |
//point cloud S | |
var V = Voronoi (S); | |
//Get intersection C of Voronoi diagram V | |
//with polygon P | |
var C = V.Intersection (P); | |
//Retrieve medial axis by selecting edges | |
//in C which do not touch the perimeter | |
//of polygon P | |
var skeleton = from edge in C | |
where (not (edge.Touches (P.Boundary)) | |
and edge.ContainedBy (F)) | |
select edge; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment