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

'strange' normal at first/last point of polyline

$
0
0

@userwithaname wrote:

I'm trying to create a circle using polylines and add some effects to vertexes of the polylines later on. When I add normals to the polyline the first and last one don't act as expected (or intended) as the normals are not parallel to the x axis: http://imgur.com/ZEOolqd

Code of the circle:

ofVec2f radius( 200, 0);
ofVec2f center = ofGetWindowSize() / 2;

float steps = 36.0;
float angle = 360.0 / steps;
ofVec2f point = center + radius;
currentPolyline.curveTo(point);
currentPolyline.curveTo(point);

for(int i = 0; i < steps; i++)
{
    radius.rotate(angle);
    point = center + radius;
    
    currentPolyline.curveTo(point);
}
currentPolyline.curveTo(point);


currentPolyline.simplify(0.7);
polylines.push_back(currentPolyline);
currentPolyline.clear();

and then just a

ofPolyline polyline = polylines[i];
polyline.draw();

to draw the circle.

What am I doing wrong? :confused:

Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles