Hi!
I’m using polylines to extract the tangents and normals from a polyline. I’m using the getTagentAtIndex() method. I don’t know if I’m doing something wrong or there’s some bug, or there’s another way to do the same.
I get the vectors with this:
vector<ofPoint> vertices = myPolyline.getVertices();
for(int i=0; i<vertices.size(); i++) {
ofVec3f tg = myPolyline.getTangentAtIndex(i);
ofVec3f nn = myPolyline.getNormalAtIndex(i);
ofVec3f rr = tg.getCrossed(nn);
}
But I’ve got some error when the point is one of those I used to generate my polyline with .curveTo():
// spiral
for(int i=0; i<nPts; i++) {
float xx = 400*sin(i*TWO_PI/nPts*3);
float yy = 400*cos(i*TWO_PI/nPts*3);
float zz = i*200;
ofPoint pt = ofPoint(xx,yy,zz);
myPolyline.curveTo(pt);
}
Al tangents and normals are OK except those corresponding to the originals points.
This is an image of the result. The vertex with numbers are the original points. Red lines ar tangents at each vertex.
Thanks for your comments!