How do you draw an angle bisector in asymptote?

As suggested by Charles Staat, Asymptote provides a 2D geometry extension geometry.asy : you can manage triangles, conic, circles, lines, segments, coordinate system with appropriate (C++ like) structures. Please find a possible solution to your question

import geometry;
point A, B, C, D;
A = (80,80);
B = (0,0);
C = (120,0);
triangle tABC=triangle(A,B,C);
draw(tABC);
line ba=bisector(tABC.VB); 
draw(ba);
point D=bisectorpoint(tABC.AC);

label("$A$", A, N);
label("$C$", C, SE);
label("$B$", B, S);
label("$D$", D,2N+E);

and the associated picture

enter image description here


A PSTricks solution only for either fun purposes or comparison.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[showgrid](5,6)
    \pstGeonode[CurveType=polyline](5;80){A}(1,1){B}(5;40){C}
    \pstBissectBAC[linecolor=red]{C}{B}{A}{N}
\end{pspicture}
\end{document}

enter image description here


Compile here: http://asymptote.ualberta.ca/

This example has more informations.

usepackage("esvect");
unitsize(1cm);
pair A=(0,0),B=(4,0),C=(3,2);
pair M=dir(A--B),N=dir(A--C);
pair A1=dir(A--M,A--N);
pair D=extension(A,A1,B,C);
draw(A--B--C--cycle);
draw(A--D);
draw(A--N--(N+M-A)--M--cycle,green);
draw(Label("$\vv{AM}$"),A--M,blue,Arrow);
draw(A--A1,gray,Arrow);
draw(rotate(degrees(N-A))*Label("$\vv{AN}$",LeftSide),A--N,red,Arrow);
draw(M--N);
dot("$A$",A,dir(180));
dot("$B$",B);
dot("$C$",C);
dot("$D$",D);

enter image description here

Tags:

Asymptote