vectorgraphics / asymptote

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

Asymptote released version 2.57? #119

Closed quanhinh9 closed 5 years ago

quanhinh9 commented 5 years ago

I'm download asymptote version 2.57 with link below and install. https://excellmedia.dl.sourceforge.net/project/asymptote/2.57/asymptote-2.57-setup.exe

After installation, I'm run command asy:

Welcome to Asymptote version 2.49 (to view the manual, type help)

And have same error: https://github.com/vectorgraphics/asymptote/issues/118

johncbowman commented 5 years ago

You need to run asy 2.57, not 2.49.

quanhinh9 commented 5 years ago

I'm download new version 2.57, but after install and asy show version 2.49.

johncbowman commented 5 years ago

This is not an asy problem. You are running the old version of asy. If you say which asy you will see that you are using another version (likely the version that comes with TeXLive). You need to make sure the new version is in your path or else specify explicitly the location where you installed it to.

quanhinh9 commented 5 years ago

This is not an asy problem. You are running the old version of asy. If you say which asy you will see that you are using another version (likely the version that comes with TeXLive). You need to make sure the new version is in your path or else specify explicitly the location where you installed it to.

Thank you.

quanhinh9 commented 5 years ago

I'm write asy code:

`\begin{asy} import geometry; unitsize(1cm); defaultpen(fontsize(11pt));

conic g2inconic(triangle t, point P) { point D=intersectionpoint(line(t.A,P),line(t.B,t.C)); point E=intersectionpoint(line(t.B,P),line(t.C,t.A)); point F=intersectionpoint(line(t.C,P),line(t.A,t.B)); point J=intersectionpoint(line(t.B,midpoint(D--F)),line(t.C,midpoint(D--E))); point Y=rotate(180,J)E; point Z=rotate(180,J)F; return conic(D,E,F,Y,Z); }

point A=(1,5); dot(Label("$A$",align=NW),A); point B=(0,0); dot(Label("$B$",align=SW),B); point C=(7,0); dot(Label("$C$",align=SE),C); draw(A--B--C--A); triangle t=triangle(A,B,C); point P=(3,2); point D=intersectionpoint(line(t.A,P),line(B,C)); dot(Label("$D$",align=SE),D); point E=intersectionpoint(line(t.B,P),line(C,A)); dot(Label("$E$",align=NE),E); point F=intersectionpoint(line(t.C,P),line(A,B)); dot(Label("$F$",align=NW),F);

conic co=g2inconic(t,P); draw(co);

point J=intersectionpoint(line(t.B,midpoint(D--F)),line(t.C,midpoint(D--E)));; dot(Label("$J$",align=SE),J); circle cj=circle(J,abs(J-D)); draw(cj);

//point[] t=intersectionpoints(co,(conic)cj); point[] t=intersectionpoints(co,cj); dot(Label("$t_1$",align=SE),t[1]);

\end{asy}`

If use: point[] t=intersectionpoints(co,cj); I get error: call of function 'intersectionpoints(conic, circle)' is ambiguous.

and I change to solve: point[] t=intersectionpoints(co,(conic)cj);

It is an error?

johncbowman commented 5 years ago

Next time it would be better to post a new bug report so others will see this too. Anyway, this problem is a result of ambiguous casting in geometry.asy (the original author of which is no longer actively developing Asymptote). Fortunately I was able to solve it by demoting implicit casts to explicit ecasts for converting general objects like conic to special cases like circle (just like when we ecast a real to an int; the user has to explicitly force this with (int)). You can fetch the new version of geometry.asy and try it out: https://raw.githubusercontent.com/vectorgraphics/asymptote/HEAD/base/geometry.asy

quanhinh9 commented 5 years ago

Sorry johncbowman, I use asymptote version 2.5.7. The circle(t[0],abs(t[0]-A)) is not exactly, it not thought point A. There is a warning [coodinatesystem]: the coordinate system of two objects are not the same. The operation will be done relative to the default coordinate system. `\begin{asy} import geometry; //import g2geo; unitsize(1cm); defaultpen(fontsize(11pt));

point A=(1.1,4); dot(Label("$A$",align=NW),A); point B=(0,0); dot(Label("$B$",align=SW),B); point C=(7,0); dot(Label("$C$",align=SE),C); draw(A--B--C--A);

triangle t=triangle(A,B,C); draw(circle(A,B,C)); point I=incenter(t); dot(Label("$I$",align=NW),I); point J=excenter(t.BC); dot(Label("$J$",align=NW),J); point M=midpoint(t.BC); dot(Label("$M$",align=SE),M);

point D=projection(line(B,C))*A; dot(Label("$D$",align=SE),D);

circle b1=incircle(t), c1=excircle(t.BC); draw(b1,red); draw(c1,red);

hyperbola hypB=hyperbola(M,b1.C,b1.r/2); draw(hypB,blue); hyperbola hypC=hyperbola(M,c1.C,c1.r/2); draw(hypC,orange);

point[] t= intersectionpoints(hypB,hypC);

dot(Label("$t_0$",align=SE),t[0]); dot(Label("$t_1$",align=SE),t[1]);

draw(circle(t[0],abs(t[0]-A)),blue);

\end{asy}`

johncbowman commented 5 years ago

Sorry, I forgot to change the points back to currentcoordsys. Grab a new copy of https://raw.githubusercontent.com/vectorgraphics/asymptote/HEAD/base/geometry.asy or wait an hour for the 2.58 release, which I am about to build. With it your example works, as well as this modification:

import geometry;
unitsize(1cm);
defaultpen(fontsize(11pt));

pair A=(1.1,4); dot(Label("$A$",align=NW),A);
pair B=(0,0); dot(Label("$B$",align=SW),B);
pair C=(7,0); dot(Label("$C$",align=SE),C);
draw(A--B--C--A);

triangle t=triangle(A,B,C);
draw(circle(A,B,C));
point I=incenter(t); dot(Label("$I$",align=NW),I);
point M=midpoint(t.BC); dot(Label("$M$",align=SE),M);

circle b1=incircle(t), c1=excircle(t.BC);
draw(b1,red); draw(c1,red);

hyperbola hypB=hyperbola(M,b1.C,b1.r/2); draw(hypB,blue);
hyperbola hypC=hyperbola(M,c1.C,c1.r/2); draw(hypC,orange);

point[] t= intersectionpoints(hypB,hypC);

for(int i=0; i < t.length; ++i) {
  dot(Label(math("t"+string(i)),align=SE),t[i]);
  draw(circle(t[i],abs(t[i]-A)),Pen(i)+dashed);
}