vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
542 stars 90 forks source link

arc(ellipse, point, point) doesn't work in non-default coordsys #334

Open jamadagni opened 2 years ago

jamadagni commented 2 years ago
import geometry;
size(10cm, 0);
currentcoordsys = cartesiansystem(i = N, j = W);

point P = (0, 0), Q = (-5, 1);
real v = abs(P - Q);
point R = P + (0, v);  // by def R lies on circle with center P and radius PQ
draw(Q -- P -- R, red + blue);
dot(P, red);
dot(Q ^^ R, blue);
draw(arc(circle(P, v), Q, R), green);
shipout(bbox(0.25cm));

As you can see the arc doesn't connect Q and R. Removing the modification of currentcoordsys, this works. Please advise what is wrong.

jamadagni commented 2 years ago
import geometry;
size(10cm, 0);
currentcoordsys = cartesiansystem(i = N, j = W);

point P = (0, 0);
circle C = circle(P, 5);
point Q = angpoint(C, 90);
point R = angpoint(C, 135);
draw(C);
draw(arc(circle(P, 5), Q, R), green + 2);
dot(P ^^ Q ^^ R);

shipout(bbox(0.25cm));

This doesn't work either.

jamadagni commented 2 years ago

Curiously, adding the coordsys modification to the given example of arc(ellipse, point, point) works. I don't understand why that example should work but my constructed examples don't.

jamadagni commented 2 years ago

In view of issue #333 I think the problem is perhaps with the underlying drawing routine which fails to compensate for rotation of coordinate system because arc(ellipse, point, point) internally seems to just go via arc(ellipse, abscissa, abscissa) to arc(ellipse, angle, angle). But I am not sufficiently confident…