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
// Note that I wrote this in java in Processing - paste this GIST into processing to see it in action. | |
// It is not the most elegant thing ever but it does deal with end caps and ribbon loops and the like. | |
// If you port this over to say objective-c / opengl / c etc - you may need to deal with polygon direction | |
// here is a snapshot of it running : http://www.flickr.com/photos/anselmhook/6507471719/in/photostream | |
int nvertices = 0; | |
float[] vertexpool = new float[3000]; | |
float x1,x2,y1,y2; | |
void intersect(int kind, float x0, float y0, float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4) { |