drawing a curved line

Are there any functions to draw an open curved line in oF? I tried:

  
  
ofBeginShape();  
loop { ofCurveVertex(x, y) }  
ofEndShape();  
  

but that wants to close the curve and I couldn’t find how to not do that. Maybe its late and I"m being a bit stupid I dunno. I guess could write it from scratch using catmull rom but if I can save time by using tools already built it would be useful…

you can specify wether or not to close:

  
ofEndShape(false);  

however that “false” should be called by default (it’s a default parameter). Can you craft a simple example that doesn’t close? I just made one that’s fine, so I’d like to see that you are having trouble with.

take care!
zach

Hi Zach, thats strange. Here is a super simple example.

  
  
	int spacing = 50;  
	ofBeginShape();  
	for(int x=0; x<ofGetWidth(); x+= spacing) {  
		ofCurveVertex(x, ofGetHeight()/2 + ofGetHeight() * 0.3f * sin(x*0.01f + ofGetFrameNum() * 0.02f));  
	}  
	ofEndShape(false);  
  

So I’d like it to just draw a moving sine wave. Instead its doing a trippy visual by connecting the first and last point, and filling in half of it. Very nice, but not what I desire in this case. (There is nothing else in the whole app, just this in draw()). I was using oF 00573, so tried with 005 just in case, and getting the same…

are you talking about filled or unfilled ?

this, is fine for me unfilled:

  
  
ofSetColor(0x000000);  
	ofNoFill();  
	  
	int spacing = 50;   
	ofBeginShape();   
	for(int x=0; x<ofGetWidth(); x+= spacing) {   
		ofCurveVertex(x, ofGetHeight()/2 + ofGetHeight() * 0.3f * sin(x*0.01f + ofGetFrameNum() * 0.02f));   
	}   
	ofEndShape(false);   
  

otherwise, if it’s filled, you need to look at winding rules, like

  
  
ofSetPolyMode(OF_POLY_WINDING_POSITIVE);  
  

if it’s filled, can you send a picture of what you think it should look like?

take care!
zach

Hi Zach, sorry I was being incredibly stupid. noFill() did the trick :oops: