Skip to content

Instantly share code, notes, and snippets.

@ofZach
Created July 1, 2016 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ofZach/8ac041d239b83735976463938f527874 to your computer and use it in GitHub Desktop.
Save ofZach/8ac041d239b83735976463938f527874 to your computer and use it in GitHub Desktop.
leaving the grid sketch
#include "ofApp.h"
ofEasyCam cam;
//--------------------------------------------------------------
void ofApp::setup(){
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofBackground(0);
ofSetColor(255);
cam.begin();
ofRotate(mouseX, 0,1,0);
ofPoint camPt = cam.getPosition();
ofSeedRandom(0);
for (int i = -20; i < 20; i++){
for (int j = -20; j < 20; j++){
ofPoint a = ofPoint(i*20, j*20);
ofPoint b = ofPoint((i+1)*20, j*20);
ofPoint c = ofPoint((i+1)*20, (j+1)*20);
ofPoint d = ofPoint(i*20, (j+1)*20);
a = (a - cam.getPosition()).getNormalized();
b = (b - cam.getPosition()).getNormalized();
c = (c - cam.getPosition()).getNormalized();
d = (d - cam.getPosition()).getNormalized();
ofDrawLine(camPt + a*ofRandom(700,800), camPt + b*ofRandom(700,800));
ofDrawLine(camPt + b*ofRandom(700,800), camPt + c*ofRandom(700,800));
ofDrawLine(camPt + c*ofRandom(700,800), camPt + d*ofRandom(700,800));
ofDrawLine(camPt + d*ofRandom(700,800), camPt + a*ofRandom(700,800));
}
}
cam.end();
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment