noc01_random_walk

noise

0

random

0

source code

ofApp.h

class ofApp : public ofBaseApp{
public:
    void setup();
    void update();
    void draw();

ofEasyCam cam;
vector<ofPoint> pts;    
ofMesh mesh;

};

ofApp.cpp

    //--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(0);
    mesh.setMode(OF_PRIMITIVE_LINE_STRIP);
}

//--------------------------------------------------------------
void ofApp::update(){
    float t = ofGetElapsedTimef();
    ofPoint pt;
    pt.x = ofSignedNoise(t * 1.8) * 50;
    pt.y = ofSignedNoise(t * 3.1) * 50;
    pt.z = 0;

    pts.push_back(pt);

    for (int i = 0; i < pts.size(); i++){
        pts[i].z+= 4;
    }

    mesh.clear();
    mesh.addVertices(pts);
}

//--------------------------------------------------------------
void ofApp::draw(){
    cam.begin();
    mesh.draw();
    cam.end();

}