将圆放入直角三角形

将圆放入直角三角形

我需要 MetaPost 的帮助,将圆圈放入直角三角形的左下角。

这是我的作品:

 beginfig(1)
      pair A,B,C,D,E,F,O,G,H,I,J,AA, BB, CC, HB, HF, DD, EE,FF,h;

      O=origin;
      A=(-1cm,0);
      B=(4cm,0);
      C=(-1cm,-1cm);
      D=(2.5cm,5cm);
      E=(4cm,-1cm);
      F=(0.5cm,5cm);

    AA= 1/2[G,H];
    BB= 1/2[I,G];
    CC= 1/2[H,I];

    DD=1/2[H,D];
    EE=1/2[H,F];
    FF=1/2[D,F];

    G= whatever [A,B];
    G= whatever [C,D];

    H= whatever [C,D];
    H= whatever [E,F];

    I= whatever [E,F];
    I= whatever  [A,B];

    (J-C)= whatever *(
      (C-A) rotated 1/2( angle(I-C) - angle(A-C)) );
    (J-I) = whatever * ((I-C)rotated 1/2(angle(A-I) - angle (C-I)));
    J-h = whatever * (I-C) rotated 90;
    h= whatever [I,A];


      draw fullcircle scaled 2 abs(J-h) shifted J;

      draw A--B;
      draw C--D;
      draw E--F;

     draw G withpen pencircle scaled 4bp;
     draw H withpen pencircle scaled 4bp;
     draw I withpen pencircle scaled 4bp;

    draw AA..BB..CC..cycle;
    draw DD..EE..FF..cycle; 

    endfig;

答案1

在此处输入图片描述

这是您想要得到的吗?已添加标签以便清晰显示。

beginfig(1)
  pair A,B,C,D,E,F,O,G,H,I,J,AA, BB, CC, HB, HF, DD, EE,FF,h;

  O=origin;
  A=(-1cm,0);
  B=(4cm,0);
  C=(-1cm,-1cm);
  D=(2.5cm,5cm);
  E=(4cm,-1cm);
  F=(0.5cm,5cm);

  AA= 1/2[G,H];
  BB= 1/2[I,G];
  CC= 1/2[H,I];

  DD=1/2[H,D];
  EE=1/2[H,F];
  FF=1/2[D,F];

  G= whatever [A,B];
  G= whatever [C,D];

  H= whatever [C,D];
  H= whatever [E,F];

  I= whatever [E,F];
  I= whatever  [A,B];

  (J-C)= whatever *((C-A) rotated 1/2( angle(I-C) - angle(A-C)) );
  (J-I) = whatever * ((I-C)rotated 1/2(angle(A-I) - angle (C-I)));
  J-h = whatever * (I-C) rotated 90;
  h= whatever [I,A];



  draw A--B;
  draw C--D;
  draw E--F;

  draw G withpen pencircle scaled 4bp;
  draw H withpen pencircle scaled 4bp;
  draw I withpen pencircle scaled 4bp;

  draw AA..BB..CC..cycle;
  draw DD..EE..FF..cycle; 

  label.ulft(btex $A$ etex, A);
  label.urt(btex $B$ etex, B);
  label.lrt(btex $C$ etex, C);
  label.urt(btex $D$ etex, D);
  label.urt(btex $E$ etex, E);
  label.ulft(btex $F$ etex, F);
  label.ulft(btex $G$ etex, G);
  label.rt(btex $H$ etex, H);
  label.urt(btex $I$ etex, I);

  label.ulft(btex $AA$ etex, AA);
  label.bot(btex $BB$ etex, BB);
  label.urt (btex $CC$ etex, CC);
  label.lrt (btex $DD$ etex, DD);
  label.llft (btex $EE$ etex, EE);
  label.top (btex $FF$ etex, FF);

  pair p,q,s;  numeric r;
  p=(AA+BB+CC)/3;
  s= whatever [p,G]=whatever[A,A+(1,-1)];
  r=ypart(G-s);

  draw fullcircle scaled 2r shifted s;

  label.top(btex $p$ etex, p);
%  label.top(btex $s$ etex, s);
  draw p withpen pencircle scaled 4bp;
  draw s withpen pencircle scaled 4bp;

endfig;
end.

答案2

我猜你正在尝试绘制一个内切圆,其圆心位于顶点角的角平分线的交点处,半径与边缘相交。在这种情况下,你的代码很接近,但实际上应该使用从角而不是线的端点发出的线段。这是生成此圆的修改(并删除了其他曲线)。我曾经将dotlabel点及其标签一起放置在顶点上。

示例输出

beginfig(1)
  pair A,B,C,D,E,F,O,G,H,I,J,AA, BB, CC, HB, HF, DD, EE,FF,h;

  O = origin;
  A = (-1cm,0);
  B = (4cm,0);
  C = (-1cm,-1cm);
  D = (2.5cm,5cm);
  E = (4cm,-1cm);
  F = (0.5cm,5cm);

  AA = 1/2[G,H];
  BB = 1/2[I,G];
  CC = 1/2[H,I];

  DD = 1/2[H,D];
  EE = 1/2[H,F];
  FF = 1/2[D,F];

  G = whatever [A,B];
  G = whatever [C,D];

  H = whatever [C,D];
  H = whatever [E,F];

  I = whatever [E,F];
  I = whatever [A,B];

  dotlabel.lrt("G",G);
  dotlabel.rt("H",H);
  dotlabel.llft("I",I);

  (J-G) = whatever * ((I-G) rotated 1/2(angle(H-G) - angle(I-G)));
  (J-I) = whatever * ((G-I) rotated 1/2(angle(H-I) - angle(G-I)));
  J-h = whatever * (I-G) rotated 90;
  h = whatever [I,A];

  draw fullcircle scaled 2 abs(J-h) shifted J;

  draw A--B;
  draw C--D;
  draw E--F;

endfig;
end

相关内容