Bug 756 : bezier tangent
Last modified: 2008-04-11 20:08




Status:
RESOLVED
Resolution:
DUPLICATE of bug 710
Priority:
P2
Severity:
normal

 

Reporter:
peony3000
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-04-11 12:50
Hello Casey.....

the tangents produced by bezier tangent are clearly wrong!

try this and you see that the first and last are not square with the
control lines

using P 0135 onWinXP sony viao laptop (a bit dusty)

size(400,400);
noFill();
translate(50,50);
//first line
bezier(0, 0, 50, 0, 50, 80, 100, 100);
line(0, 0, 50, 0);
line(50, 80, 100, 100);
int steps = 50;
for (int i = 0; i <= steps; i++) {
float t = i / float(steps);
float x = bezierPoint(0, 50, 50, 100, t);
float y = bezierPoint(0, 0, 80, 100, t);
float tx = bezierTangent(0, 50, 50, 100, t);
float ty = bezierTangent(0, 0, 80, 100, t);
float a = atan2(ty, tx);
a += PI/2.0;
line(x, y, cos(a)*20 + x, sin(a)*20 + y);
}
//second line
bezier(100, 100, 150, 120, 150, 200, 200, 200);
line(100, 100, 150, 120);
line(150, 200, 200, 200);
for (int i = 0; i <= steps; i++) {
float t = i / float(steps);
float x = bezierPoint(100, 150, 150, 200, t);
float y = bezierPoint(100, 120, 200, 200, t);
float tx = bezierTangent(100, 150, 150, 200, t);
float ty = bezierTangent(100, 120, 200, 200, t);
float a = atan2(ty, tx);
a += PI/2.0;
line(x, y, cos(a)*20 + x, sin(a)*20 + y);
}
Additional Comment #1 From fry 2008-04-11 20:08


*** This bug has been marked as a duplicate of 710 ***