Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Sine graph from array

$
0
0

@antocreo wrote:

HI,
I am trying to display the streamed data that I get from an array so that I see the line moving as the data change.
here is the code I am using. But the visual result I get is a bit odd. I don't understand where is the mistake.
Anyone any help please?

ofBeginShape();
    ofNoFill();
    ofSetLineWidth(linewidth);
    ofSetColor(color);
    float k = TWO_PI/wl;     //wl is the wavelength
    
    if (videoTracker.getFound()) {
        for (int x=0; x<ofGetFrameNum()%ofGetWidth()/3; x++) {
            ofCurveVertex(xpos + x, ypos + sin(k*(x) -  ofDegToRad(dataPointer[index%arraySize])) * amplitude );
        }
    }
    ofEndShape();

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles