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
// usage for DSP | |
// https://github.com/vinniefalco/DSPFilters | |
#include "Dsp.h" | |
// variables... these filters want a float ** array, so I allocate it like this: | |
Dsp::Filter* f; | |
float* audioData[1]; |
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
#include "testApp.h" | |
// this can go in your h file; | |
ofPoint pts[5]; | |
uint ctr; | |
ofPath path; | |
ofPolyline lineOrig; | |
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
File.open('test.txt', 'r+') do |f| | |
out = "" | |
f.each do |line| | |
out << line.gsub(/\[([^\]]+)\]\(([^)]+)\)/, '<a target="_blank" href="\2">\1</a>') | |
end | |
f.pos = 0 | |
f.print out | |
f.truncate(f.pos) | |
end |
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
// in .h file: | |
ofNode a,b,c; | |
float aEnergy; | |
float bEnergy; | |
float aEnergySmth; | |
float bEnergySmth; | |
float time; | |
ofPolyline nodeLine; |
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
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
glEnable(GL_DEPTH_TEST); | |
ofEnableLighting(); | |
ofLight light; | |
light.setPosition(ofPoint(-200,0, -1000)); | |
light.lookAt( ofPoint(-1000,0,0)); | |
light.setDirectional(); |
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
// in main.cpp | |
ofAppGLFWWindow w; | |
ofSetupOpenGL(&w, 1024,432,OF_WINDOW); // <-------- setup the GL context | |
testApp * app = new testApp(); | |
app->WINDOW = &w; | |
ofRunApp(app); |
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
// was noticing sin(ofGetElapsedTimef()) gets crunchy at some point, because of lower resolution in sin / cos. here's an alternative function that seems to help... not tested for speed. | |
float ofGetElapsedTimeForSin(){ | |
long long timeNow = ofGetElapsedTimeMillis(); | |
long long modForTwoPi = (int)(TWO_PI*1000.0); | |
return ((float)(timeNow % modeForTwoPi)/1000.0); | |
} |
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
// medianFilter filter; | |
// filter.addValue(5); | |
// filter.addValue(3); | |
// filter.addValue(2); | |
// filter.addValue(100); | |
// filter.addValue(9); | |
// Serial.println(filter.getMedian()); | |
// | |
// filter.addValue(100); | |
// Serial.println(filter.getMedian()); |
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
// useful for projection alignment, etc: | |
// http://i.imgur.com/rWJLE.jpg | |
int nbOfCol = ofGetWidth() / 25; | |
int boardWidth = ofGetWidth(); | |
int boardHeight = ofGetHeight(); | |
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
/// This is a recipe from the O'Reilly Safari Cookbook | |
/// http://safari.oreilly.com/0596007612/cplusplusckbk-CHP-11-SECT-5 | |
/// Usage: | |
/// vector<int> v; | |
/// computeStats(v.begin( ), v.end( ), sum, mean, var, dev, skew, kurt); | |
#pragma once |