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

Problem with insterting points into ofPolyline

$
0
0

@udiskie wrote:

Hello i'm trying to load points from an ofVec2f array into a ofPolyline, but i got a bit lost.

This is what i have:

void MyClass::updatePoints(){
	int seg = 30;
	angle = start;

	for (int i = 0; i < sizeof(points)/sizeof(*points); ++i)
	{
		float y = ofMap(sin(angle),-1,1,0,amplitude);
		points[i].set(i*seg, y);
		line.insertVertex(points[i],i);
		angle += speed;
	}

	start += 0.02;
}

questions:
- why it is endlessly adding points with new values to my polyline instead of overwriting them since i'm giving the same indexes in the "for loop"?

-what other ways are to solve this same problem?

thanks in advance.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles