4

I'm trying to mark an angle on a 3d plot with \tkzMarkAngle which seems to behave quite oddly in combination with \tdplotsetmaincoords

Here's what I mean, below is the minimal example:

\documentclass[varwidth=true, border=2pt]{standalone}

\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\tdplotsetmaincoords{0}{315}
\begin{tikzpicture}[tdplot_main_coords]
  \coordinate (OX) at (1,0,0);
  \coordinate (OO) at (0,0,0);
  \coordinate (OY) at (0,1,0);
  \tkzMarkAngle[fill=purple](OX,OO,OY)
  \draw (OY) -- (OO) -- (OX);
\end{tikzpicture}
\end{document}

As you can see, I'm simply trying to draw an angle and mark it with a filled arc. However what I get is the following:

An angle and an arc.

Seems like the arc is rotated twice the angle it should be. Does anyone else have the same result? Or is it me having a buggy version of tikz?.

I'm running on OSX, latex and tikz installed through macports.

Thanks.

UPD1. Here's how a 20 degrees rotation looks (\tdplotsetmaincoords{0}{20}):

Angle and an arc 2

4
  • Is not a bug. \tkzMarkAngle doesn't respond to \tdplotsetmaincoords{0}{315} (why should it?). Aug 17, 2015 at 22:02
  • Welcome to TeX.SX! Aug 17, 2015 at 22:08
  • @GonzaloMedina Well, if it didn't respond I would expect the arc to face right side, not left. I also updated the post with what a 20 degree rotation looks like.
    – SiLiKhon
    Aug 17, 2015 at 22:10
  • @SiLiKhon Hmmm... I see your point now. Yes, there seems to be some problem with \tkzMarkAngle. I proposed an alternative approach below. Aug 17, 2015 at 23:11

2 Answers 2

4

As you mentioned, there seems to be an odd behaviour of \tkzMarkAngle and \tdplotsetmaincoords. As a work-around, you could use the angles library:

\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{angles}

\begin{document}

\tdplotsetmaincoords{0}{315}
\begin{tikzpicture}[tdplot_main_coords]
  \coordinate (OX) at (1,0,0);
  \coordinate (OO) at (0,0,0);
  \coordinate (OY) at (0,1,0);
%  \tkzMarkAngle[fill=purple](OX,OO,OY)
  \draw (OY) -- (OO) -- (OX)
     pic[fill=purple!20,angle radius=9mm] {angle = OX--OO--OY};
\end{tikzpicture}

\end{document}

The result:

enter image description here

A longer example; the bending library was added to improve the look for the curved arrows:

\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{angles,bending}

\begin{document}

\tdplotsetmaincoords{30}{120}
\begin{tikzpicture}[
  tdplot_main_coords,
  markangle/.style={draw,->,>=latex}
]
  \coordinate (OX) at (1,0,0);
  \coordinate (OO) at (0,0,0);
  \coordinate (OY) at (0,1,0);
  \coordinate (OZ) at (0,0,2);
  \path
    pic[fill=purple!20,angle radius=5mm,markangle] {angle = OY--OO--OZ}
    pic[fill=green!20,angle radius=5mm,markangle] {angle = OX--OO--OY}
    pic[fill=blue!20,angle radius=5mm,markangle] {angle = OZ--OO--OX};
  \draw 
    (OX) -- (OO) 
    (OY) -- (OO) 
    (OZ) -- (OO); 
%  \tkzMarkAngle[fill=purple](OX,OO,OY)
\end{tikzpicture}

\end{document}

enter image description here

2
  • Looks nice, thanks a lot! Is it also possible to draw an arrow arc with this library? Like this i.stack.imgur.com/lOWYu.png
    – SiLiKhon
    Aug 17, 2015 at 23:28
  • @SiLiKhon You're welcome. Sure it's possible. See my updated answer (drop the fill=<color> options if you don't want the filling). Aug 17, 2015 at 23:43
2

Certainly a bug. You can the new version of tkz-euclide v2.42 (beta) here

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .