Created
August 14, 2011 17:07
-
-
Save underdoeg/1145079 to your computer and use it in GitHub Desktop.
math stuff
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 "mathPlaygroundApp.h" | |
ofVec2f v1; | |
ofVec2f v2; | |
ofVec2f between; | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::setup(){ | |
ofSetWindowTitle("mathPlaygroundApp"); | |
ofBackground(0,0,0); | |
keyReleased(' '); | |
//v1.set(0, 200); | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::update(){ | |
v2.set(mouseX-ofGetWidth()*.5, mouseY-ofGetHeight()*.5); | |
between = v1.getPerpendicular(); | |
between -= v2.getPerpendicular(); | |
between.scale(400); | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::draw(){ | |
ofTranslate(ofGetWidth()*.5, ofGetHeight()*.5); | |
ofVec2f center(0,0); | |
ofSetColor(255); | |
ofLine(center, v1); | |
ofLine(center, v2); | |
ofSetColor(255, 0, 0); | |
ofLine(center, between); | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::keyPressed(int key){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::keyReleased(int key){ | |
v1.set(ofRandom(-500, 500), ofRandom(-500, 500)); | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::mouseMoved(int x, int y ){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::mouseDragged(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::mousePressed(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::mouseReleased(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::windowResized(int w, int h){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::gotMessage(ofMessage msg){ | |
} | |
//-------------------------------------------------------------- | |
void mathPlaygroundApp::dragEvent(ofDragInfo dragInfo){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment