2

I just realized that the positioning of the border anchors doesn't seem very consistent, as you can see in the following picture (those are nodes placed over border anchors of a circular node).

enter image description here

This image was created with something similar to the code below.

\node[circle, draw, minimum size=10](c){};
\foreach \i in {0,...,359}{
    \node[fill=green,opacity=0.5]at(c.\i){};
}

Is it possible to improve this situation without using too much of workaround? I would be very happy to understand why it happens.


As I told to @marmot in the comments of his answer, I'm already working around this problem with something similar to what he suggested. The problem is that this slows the compilation badly and the new anchors are not well positioned due to accumulated rounding errors. I tried to clarify my question.

  • You'd really benefit from providing a full MWE. If I paste your code into my MWE below, I get dimension too large errors. And frankly I am not 100% happy how you just incorporate my answer and comments into your question. Wouldn't it be more appropriate to ask a new question instead? – user121799 Nov 30 '18 at 17:59
  • @marmot I don't know about yours, but my solution came from this question I asked myself many years ago. tex.stackexchange.com/q/75371/19096 I didn't just incorporate your answer, I'm not 100% happy as well about how you say it. As I told you, you just arrived to the same point I was, which is not a solution for what I want. Anyway, I upvoted your answer and I gave you credits for the part I learned from you, which is just a side point. – tcpaiva Nov 30 '18 at 19:42
  • @marmot Thanks for pointing out the problem "dimension too large". I just had to include a unit for the "minimum size" option. My diagram is much more complex and with weird dimensions, that is why I just took the relevant par from there, hence the absence of a MWE. As it was not part of the problem, I was not worried about people trying to execute it. I just updated with the full MWE. – tcpaiva Nov 30 '18 at 21:16
  • BTW, @marmot, what do you suggest for a new question? I think my question is still relevant. I still want to know how can we improve the positioning of border anchors, which is a tikz feature. Or maybe some one will show up and explain why it is not possible... – tcpaiva Nov 30 '18 at 21:20
  • 1
    Yes, tex.stackexchange.com/a/76484/19096 is a very nice answer which I upvoted long ago. And I guess your issue is related to this one. – user121799 Nov 30 '18 at 22:39
2

Here is one possibility. (You do not need to use nodes to draw the small circles either).

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\draw[postaction={decorate,decoration={markings,% switch on markings 
mark=% actually add a mark
between positions 0 and 1 step 1/360
      with
      {
        \node[fill=green,opacity=0.5,circle,inner sep=2.5pt]{};
      }
}}] (0,0) circle (10);
\end{tikzpicture}
\end{document}

enter image description here

  • Thanks, @marmot. I did exactly the same for now, sorry for not making it clear in the question. The compile time slows a lot. I was wondering if there were anything we could do without redrawing everything. BTW, i didn't know we could use 1/360 for the steps, it feels a bit magical. – tcpaiva Nov 30 '18 at 16:35
  • @tecepe What do you mean by redrawing? – user121799 Nov 30 '18 at 16:37
  • When you do the postaction, it is effectively drawing the path another time. Anyway, another question based on your answer. I'm using node instead of path to create the outer circle, and that node has a name, which allows me to access the border anchors afterwards. Is there an automated way to inherit the node name to add related names to the new border anchors we are creating with the markings? – tcpaiva Nov 30 '18 at 16:44
  • @tecepe No, I do not think so. However, you could give the circle nodes names that correspond to their position, sth like ` name=mark-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}. (And no, postaction` does not draw the path a second time. BTW, the coordinates on the big circle a simply (<angle>:10) in polar coordinates.) – user121799 Nov 30 '18 at 16:47
  • I updated the question with what I have and with the info we discussed. Thanks for the 1/360 tip! – tcpaiva Nov 30 '18 at 17:45

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.