3

I have written asymptote code:

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

 pair A=(0.8,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=NW),M);

 circle b=incircle(t), c=excircle(t.BC);
 draw(b,red); draw(c,red);

 hyperbola hypB=hyperbola(M,b.C,b.r/2); draw(hypB,brown);
 hyperbola hypC=hyperbola(M,c.C,c.r/2); draw(hypC,orange);

 point[] temp=intersectionpoints(hypB,hypC);
 //dot(Label("$t_0$",align=SE),temp[0]);

 \end{asy}

When I draw 2 hyperbolas (as shown above) and find their intersections using the function intersectionpoints(hypB,hypC), it doesn't return any value.

Please help me fix this code.

enter image description here

1
  • Where can one find the g2geo module?
    – user194703
    Commented Oct 5, 2019 at 14:16

3 Answers 3

3

Update : the bug in geometry.asy is fixed (and the original code works). See https://github.com/vectorgraphics/asymptote/commit/2a237885ddc65eb8db7fc9a8d2fa51c17a5b25a1 and https://github.com/vectorgraphics/asymptote/commit/d63f1d90e26cfc27d496daee95858ed03b78692a Tests and feedbacks are welcome.

Original answer :

First it seems that there is a bug into geometry.asy. For the hyperbola intersection, the routine is first to derive the corresponding quartic equation and then to use a quartic complex resolution and to extract real roots. In your example the equation is not degenerated and clearly there is bug : the routine does not accept a null coefficient in y^2 for both hyperbola.

Secondly, even if an hyperbola has two parts, the path casting extracts only one. It is why path hypB=hyperbola(M,b.C,b.r/2) gives an incomplete picture. It is possible to add the second part by hyperbola(b.C,M,b.r/2).

Please find a workaround (the geometry.asy specific intersectionpoints should be improved).

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

pair A=(0.8,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=NW),M);

circle b=incircle(t), c=excircle(t.BC);
draw(b,red); draw(c,red);

path[] hypB=hyperbola(M,b.C,b.r/2)^^hyperbola(b.C,M,b.r/2);
draw(hypB,brown);
path[] hypC=hyperbola(M,c.C,c.r/2)^^hyperbola(c.C,M,c.r/2);
draw(hypC,orange);

pair[] tp=intersectionpoints(hypB,hypC);
for (int i=0;i<tp.length;++i)
{
    dot(Label("$T_"+string(i)+"$",align=SE),tp[i]);
}

and the result

enter image description here

2

It works without problems if one replaces hyperbola by path. Note that I do not have the g2geo module.

\documentclass[border=3mm]{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=hyperbolae}
 import geometry;
 //import g2geo;
 unitsize(1cm);
 defaultpen(fontsize(11pt));

 pair A=(0.8,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=NW),M);

 circle b=incircle(t), c=excircle(t.BC);
 draw(b,red); draw(c,red);

 path hypB=hyperbola(M,b.C,b.r/2); draw(hypB,brown);
 path hypC=hyperbola(M,c.C,c.r/2); draw(hypC,orange);

 pair[] isp=intersectionpoints(hypB,hypC);
 dot(Label("$t_0$",align=SE),isp[0]);
 dot(Label("$t_1$",align=SW),isp[1]);

\end{asypicture}
\end{document}

enter image description here

5
  • Thanks Schrödinger's cat. May be the function intersectionpoints(hypB,hypC) error?
    – Tran Quan
    Commented Oct 5, 2019 at 15:26
  • 1
    @TranQuan I don't know. It seems to expect a path.
    – user194703
    Commented Oct 5, 2019 at 15:27
  • Hi Schrödinger's cat, There are three intersects of (hypB,hypC). If use path, there are only two intersects.
    – Tran Quan
    Commented Oct 5, 2019 at 15:33
  • 1
    @TranQuan Really? I only see two of them.
    – user194703
    Commented Oct 5, 2019 at 15:35
  • third point is the nine point center of triangle ABC. It not show with path.
    – Tran Quan
    Commented Oct 5, 2019 at 15:38
2

This bug in geometry.asy was fixed in Asymptote version 2.57.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .