Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I use the let syntax to draw an arc when using tikz-3dplot? At the present, the arc is drawn but doesn't look right.

\documentclass[tikz, convert = false]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
\begin{document}
\tdplotsetmaincoords{60}{130}
\begin{tikzpicture}[tdplot_main_coords]
  \coordinate (O) at (0, 0, 0);
  \node[coordinate] (P) at (3, 4, 5) {};

  \draw[-latex] (O) -- +(4, 0, 0) node[font = \small, pos = 1.1] {\(x\)}
  coordinate (X);

  \draw[dashed, gray] (P) -- +(0, 0, -5) coordinate (P1) -- (O);

  \draw[-latex] let
    \p0 = (O),
    \p1 = (X),
    \p2 = (P1),
    \n1 = {atan2(\x1 - \x0, \y1 - \y0)},
    \n2 = {atan2(\x2 - \x0, \y2 - \y0)},
    \n3 = {1cm},
    \n4 = {(\n1 + \n2) / 2}
  in (O) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2];
\end{tikzpicture}
\end{document}

enter image description here

share|improve this question
    
Why doesn’t it look right? If you add \draw (O) circle [radius=1cm]; you will see that the arrow tip adds a small nudge to the arc but otherwise it looks correct. See for a similar problem (and no solution) Why are bent arrows with arrow tips not symmetric in TikZ? –  Qrrbrbirlbel Sep 7 '13 at 21:23
    
@Qrrbrbirlbel it doesn't look natural. It looks skewed or bowed. –  dustin Sep 7 '13 at 21:24
    
@Qrrbrbirlbel it isn't the arrow tip that is the problem. It is the arc. –  dustin Sep 7 '13 at 22:05
    
Are you sure? Have you compared your arc with the circle path I posted earlie? If I remove -latex from the arc they nicely overlap; with the arrow tip the arc does not overlap perfectly with the circle. –  Qrrbrbirlbel Sep 7 '13 at 22:19
    
@Qrrbrbirlbel I see what you are saying now. Is there anything that can be done here? –  dustin Sep 7 '13 at 22:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.