Skip to content

Instantly share code, notes, and snippets.

@bakercp
Created December 9, 2014 01:04
Show Gist options
  • Save bakercp/e324f42d5a7f3a9492e9 to your computer and use it in GitHub Desktop.
Save bakercp/e324f42d5a7f3a9492e9 to your computer and use it in GitHub Desktop.
ofSketch ofxDelaunay Example
/// 1. Download the zip file here: https://github.com/obviousjim/ofxDelaunay
/// 2. Extract it into your data/openFrameworks/addons folder of ofSketch.
/// 3. Make sure that the folder is called ofxDelaunay, not ofxDelaunay-master or something.
/// 4. Open ofSketch and paste the following code into a new sketch.
/// 5. Using the "Addons" button (+ in a circle next to the paperclip), scroll down and make sure ofxDelaunay is checked.
/// 6. Run!
#include "ofxDelaunay.h"
ofxDelaunay triangulation;
void setup() {
// put your setup code here, to run once:
}
void draw() {
ofNoFill();
triangulation.draw();
ofDrawBitmapString("'r' to reset", ofPoint(10,20));
}
void mouseReleased(int x, int y, int button){
triangulation.addPoint(ofPoint(x,y));
triangulation.triangulate();
}
void keyPressed(int key) {
if(key == 'r'){
triangulation.reset();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment