Skip to content

Instantly share code, notes, and snippets.

View unohee's full-sized avatar

Heewon Oh unohee

View GitHub Profile
@unohee
unohee / sequencer.cpp
Last active May 3, 2016 00:22
Sequencer snippets for Infinite Machine
void Sequencer::setup(unsigned int length, int pulse, float _radius, int mode){
angle = 360.f / (float)length;
seq_len = length;
radius = _radius;
nrCircle = 1;
angleStep = 360 / nrCircle;
Bjorklund::setup(length, pulse);
iter();
//init array
steps.clear();
@unohee
unohee / PolyGUI.cpp
Last active May 2, 2016 23:57
Polygonal Mesh for Euclidean Sequencer Snippet
void ofApp::update(){
vector<ofPoint>steps;
ofMesh innerPoly;
ofPolyline clock;
centre = ofVec2f(posX, posY);//set the centre position of all vertices
//updating all position of steps
for(int i = 0; i < seq_len; i++){ //do iteration for all elements of sequence(seq_len)
steps.insert(steps.begin()+i, ofVec2f(centre.x + radius * cos(angle*i*PI/180),centre.y + radius * sin(angle*i*PI/180)));
//gets circles coordinates
@unohee
unohee / randomMesh.cpp
Last active May 2, 2016 23:47
mesh snippets for Infinite Machine
void ofApp::update(){
//Test Drawing
if(bEuclid == true){//when sequencer triggers.
//add vertex values randomly.
for(int i=0; i < seq_len;i++){
verts[i] = ofPoint (ofRandom(0, ofGetWidth()/2), ofRandom(0, ofGetHeight()/2),ofRandom(-25,25));
mesh.addVertices(verts);
mesh.addTriangle(3, 2, 0);
mesh.addTriangle(3, 1, 2);
//
// simpleSphere.cpp
// Processing-like 3D primitive-based particle class.
// Created by UNO H
//
//
#include "simpleSphere.h"
simpleSphere::simpleSphere(){
#include "ofMain.h"
class ofxMeshFont2D :public ofTrueTypeFont{
public:
void loadFont(string file, int size){
ofTrueTypeFont::load(file, size,true,true,true);
}
@unohee
unohee / gist:b6769618bbedff5b12d5500ffec05845
Created April 8, 2016 18:54 — forked from ofZach/gist:8242765
billboard using ofNode / ofCamera
//--------------------------------------------------------------
void testApp::draw(){
glEnable(GL_DEPTH_TEST);
ofEnableLighting();
ofLight light;
light.setPosition(ofPoint(-200,0, -1000));
light.lookAt( ofPoint(-1000,0,0));
light.setDirectional();
@unohee
unohee / InfinitySeries.cpp
Last active January 30, 2016 19:51
Infinity Series Prototype : coded version of Infinity Series
#include "InfinitySeries.hpp"
void InfinitySeries::generate(int size){
series.assign(size,0);//populate array first
index = 0; //set index for the array.
//start from fundamental. numbers only shows the relative relationships(interval) but absolute relationship.
do{
//first two step.
@unohee
unohee / GCD.cpp
Created January 7, 2016 06:02
Greatest Common Divisor Algorithm (in C++)
int ofApp::GCD(int first, int second){
//Euclid Algorithm : finding the greatest common divisor.
//first, we need to figure out which number is the greatest common divisor.
//Debug function : we can see values with this bool.
bool print = true;
int gcd;//create int for GCD.
int iter;
@unohee
unohee / Bjorklund.cpp
Last active April 6, 2024 15:29
Bjorklund Algorithm in C++
#include "Bjorklund.h"
//Edited NoisyLittleBurger's Bjorklund Algorithm in C
//http://www.noisylittlebugger.net/diy/bjorklund/Bjorklund_Working_Final/Bjorklund_algorithm_arduino.txt
//CHANGED :
//1. use dynamic array.
//2. fixed sequence's off-spot problem
//3. added Explanation about Algorithm based on G.Touissant's Paper,
//"The Euclidean Algorithm Generates Traditional Musical Rhythms"
//
@unohee
unohee / PolySynth.cpp
Last active December 24, 2015 18:00
ofxMidi / ofxMaxim Polyphonic Synthesizer Example
void ofApp::newMidiMessage(ofxMidiMessage& msg) {
//RtMidi Callback.
// make a copy of the latest message
midiMessage = msg;
//ASSIGNING NEW ENUMS FOR M-Audio Keystation 32----------------------------------