I'm trying to draw a little picture with TikZ. It should show an equilateral triangle with length 1 and circles with radius 1/2 on each corner of the triangle. Next, the intersections of the circles should be highlighted with a dot. This is what I tried so far:


    \coordinate (a) at (0,0);
    \coordinate (b) at (1,0);
    \coordinate (c) at (0.5,0.866);

    \draw[dashed] (a)--(b)--(c)--(a);
    \draw[name path=circleA] (a) circle (0.5);
    \draw[name path=circleB] (b) circle (0.5);
    \draw[name path=circleC] (c) circle (0.5);

    \fill (0.5,0) circle (1pt);
    \path [name intersections={of=circleA and circleC,name=AC}];
    \fill (AC-1) circle (1pt);
    \path[name intersections={of=circleB and circleC,name=BC}];
    \fill (BC-1) circle (1pt);

enter image description here

As one can see, the intersections aren't placed exactly where they should be, because the triangle isn't perfectly equilateral. How can I do that?

  • Try \coordinate (c) at (60:1); for coordinate c. Then the rest should work out by itself ;-) – Benedikt Bauer Apr 5 '15 at 18:57

Intersection computations rely on numerically sensitive mechanisms and it does not always give you the precision you are looking for especially if tangents are in question (they get very close and might trigger and early/late true signal). But since the problem is relatively easy geometrically you can get away with many options. Here is another one

  \draw[dashed](0,0) coordinate (a)--+(1,0) coordinate (b)--+(60:1) coordinate (c) --cycle;
  \foreach\x[remember=\x as \lastx (initially c)] in{a,b,c}{
    \node[fill,circle,inner sep=1pt] at($(\x)!0.5!(\lastx)$)  (\x-\lastx) {};
    \draw (\x)circle (0.5);

enter image description here

  • 2
    @Jeroen: Note the cycle , which gives a better corner. – hpekristiansen Apr 5 '15 at 19:39
  • @percusse: Is it necessary (\x-\lastx)? Great answer – jpayansomet Apr 5 '15 at 20:34
  • @jpayansomet Thank you. I don't think so but I couldn't think of something else to, both, stay in the loop and find the midpoints. So I cooked this up. But I'm not really bright on Sunday evenings hence please let me know if I'm missing the obvious. – percusse Apr 5 '15 at 20:36
  • @jpayansomet Ah you mean the node names... Yes the question owner said they have to be referenced but after the edit it is gone... See I'm not that bright hahaha – percusse Apr 5 '15 at 20:55
  • @percusse: You're right. In my original question, I asked for the nodes to be named, but afterwards, I realised that I don't specifically use the intersections in my text, so it seemed a bit redundant to name them. – Jeroen Apr 6 '15 at 14:21

Not sure this is the best way, but...

circles at corners

    \node (tri) [regular polygon, regular polygon sides=3, draw, densely dashed, minimum width=50mm] {};
    \foreach \i/\j in {1/2,2/3,3/1}
      \node [draw] at (tri.corner \i) [circle through={($(tri.corner \i)!1/2!(tri.corner \j)$)}, draw] {};
      \path [fill] ($(tri.corner \i)!1/2!(tri.corner \j)$) circle (2.5pt);

With tkz-euclide (made more verbose for clarity)

\tkzDefMidPoint(A,B) \tkzGetPoint{D}
\tkzDefMidPoint(B,C) \tkzGetPoint{E}
\tkzDefMidPoint(A,C) \tkzGetPoint{F}
%\tkzDrawLines[add = 0 and 2/3](A,G B,G C,G)

enter image description here


One way among others of solving this, with MetaPost for whom it may interest. The equilateral triangle is built by rotating a unit side by 60°, and the intersections are found using the intersectionpoint operator. It is interesting to notice that this operator fails with MetaPost's default fixed-point arithmetic. Only after switching to floating-point numerics (\mplibnumbersystem{double}) it is able to find the intersection points.

    numeric u; u = 5cm; path circle[];
      z1 = origin; z2 = (u, 0); z3 = z2 rotatedaround (z1, 60);
      draw z1 -- z2 -- z3 -- cycle dashed evenly;
      for i= 1, 2, 3:
        circle[i] = fullcircle scaled u shifted z[i];
        draw circle[i];
      z12 = circle1 intersectionpoint circle2;
      z13 = circle1 intersectionpoint circle3;
      z23 = circle2 intersectionpoint circle3;
      for i = 12, 13, 23:
        drawdot z[i] withpen pencircle scaled 5bp;

To be typeset with LuaLaTeX. Output:

enter image description here

  • You can make this work with the default number system, if you find the intersections before you scale them up. But it won't be very accurate. Then again, you really don't need to use intersectionpoint here - all you need is z12 = .5[z1,z2] etc. – Thruston Apr 6 '15 at 22:50
  • @Thruston I knew that, like everybody else here. But computing the intersections was part of the game. Thanks for the remark about the scaling. Previously I noticed (for a different problem) that the linear equation solver also could fail after scaling and succeed before. – Franck Pastor Apr 6 '15 at 23:11
  • Yes sure, and the discussion reveals that MP's intersection algorithm is not optimized for find the tangent points of two circles (which is not surprising since it's always the midpoint of the two centres). It's interesting to find out that the intersections work better with the new number system - but that may just be an accident of the way they are implemented. – Thruston Apr 6 '15 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.