mrotondo / Edgy

Objective-C library for Delaunay Triangulation/Voronoi Diagram generation and Natural Neighbor Interpolation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Edgy does 3 things:

Delaunay Triangulations

#import "DelaunayTriangulation.h"
DelaunayTriangulation *triangulation = [DelaunayTriangulation triangulationWithSize:CGSizeMake(1000, 1000)];

UITouch *touch = (UITouch *)[touches anyObject];
CGPoint loc = [touch locationInView:self.view];
DelaunayPoint *newPoint = [DelaunayPoint pointAtX:loc.x andY:loc.y];
[self.triangulation addPoint:newPoint];

Voronoi Diagrams

NSDictionary *voronoiCells = [self.triangulation voronoiCells];

Natural Neighbor Interpolation

UITouch *touch = (UITouch *)[touches anyObject];
CGPoint loc = [touch locationInView:self.view];
DelaunayPoint *newPoint = [DelaunayPoint pointAtX:loc.x andY:loc.y];
[self.triangulation interpolateWeightsWithPoint:newPoint];

After interpolateWeightsWithPoint is called, each DelaunayPoint in the DelaunayTriangulation object's points set will have a contribution property that is between [0, 1] and represents the weight of that point's contribution to the output at the interpolated point.

License

Code is under the Creative Commons Attribution 3.0 Unported license.

About

Objective-C library for Delaunay Triangulation/Voronoi Diagram generation and Natural Neighbor Interpolation.


Languages

Language:Objective-C 100.0%