# Problem fitting a right angle

Why the right angle does not fit with a rotation angle of 90 + 15 ?

   \documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}

beginfig(1);
numeric u;
u = 1cm;
path cercle, sq, circle;

cercle = halfcircle  rotated 15 scaled 7u;
sq = unitsquare scaled 6;

z0 = point 0 of cercle;
z1 = point 6 of cercle;
z2 = point 2.5 of cercle;

draw z0 -- z1;
draw z0 -- z2;
draw z1 -- z2;

draw sq  shifted z2 rotatedaround(z2,-105);

draw cercle;
draw circle;

dotlabel.top("$I$",origin);
dotlabel.ulft("$M$",z2);
dotlabel.urt("$B$",z0);
dotlabel.lft("$A$",z1);
label.urt("$(C)$", point 1.5 of cercle);
endfig;
\end{mplibcode}
\end{document}


• The rotation by -105 for the unit square is incorrect. The correct rotation should be by -112.5 degrees. (112.5 = 180 - (15 + 105/2).) May 16 at 18:17
• Could you give a little more explanation ? May 17 at 14:08
• Draw a horizontal line k through A. The angle made by k with AB is 15 degrees. The angle MIA is equal to 2.5/6 * 180 = 75 degrees. The triangle MIA is isosceles, so the angle MAI is (180-75)/2 = 105/2 = 52.5 degrees. So the angle between k and MA is 15 + 52.5 degrees. So factoring in the initial orientation of the box, you want to first rotate it by 180 degrees to move from top left to bottom right (of the marked vertex) and then another 67.5 degrees to line it up. May 17 at 17:59
• If you need more, ask on Math.SE; since geometry I think is off topic here. :-) May 17 at 18:04
• Thanks, that's very clear. May 21 at 16:58

I do not see why it should be -105 (I think it should be -108.75, but it is probably easier not to do the calculations yourself). Let me add way of doing what you want where MetaPost is doing them for you.

numeric u;
u = 1cm;
path cercle, sq, circle;

circle = fullcircle scaled 7u ;

z0 = point 0 of circle rotated 15 ;
z1 = point 4 of circle rotated 15 ;
z2 = point 2.5 of circle rotated 15 ;

draw circle ;
draw z0--z1--z2--cycle ;

path rangle ;
rangle := (6,0)--(6,6)--(0,6) ;

draw rangle rotated angle(z1 - z2) shifted z2 ;

dotlabel.top("$I$",origin);
dotlabel.ulft("$M$",z2);
dotlabel.urt("$B$",z0);
dotlabel.lft("$A$",z1);
label.urt("$(C)$", point 1.5 of circle);


Looks like this:

• Thanks, Metapost does this very well ! May 17 at 14:10

This is just a comment, a way of Asymptote that its development is inspired by MetaPost. The Asymptote's module geometry.asy provides a lot of routines for usual tasks in Euclidean geometry, say markrightangle.

// http://asymptote.ualberta.ca/
unitsize(1cm);
import geometry;   // for markrightangle
real u=3;
path cercle =scale(u)*unitcircle;
//path cercle =circle((0,0),u);    // an alternative

pair B = u*dir(20);
pair A = -B;
pair M = u*dir(130);

markrightangle(A,M,B);

draw("$(\mathcal{C})$",cercle,blue);
draw(B--A--M--cycle,magenta);

dot(Label("$I$",align=S),(0,0));
dot("$M$",align=NW,M);
dot("$B$",align=E,B);
dot("$A$",align=W,A);
//label("$(\mathcal{C})$", (u+.3)*dir(75),blue);

shipout(bbox(5mm,invisible));

• The Metafun set of macros for MetaPost has a similar macro as well: anglebetween, which can be set to draw a right angle as well as general one. See its document, p. 297: pragma-ade.com/general/manuals/metafun-p.pdf May 17 at 18:22