8

I'm trying to draw a normal vector on a curve, and use the usual "dot in an arc" symbol to indicate that. Here is what I have so far, which looks alright, but needed manual adjustment of angles and distances, and I was wondering if one can automatically place these.

\documentclass{scrartcl}

\usepackage{tikz}

\usetikzlibrary{positioning,arrows}

\begin{document}
\begin{tikzpicture}
    \pgfmathsetmacro\rightAngleRadius{0.2}
    \coordinate (start) at (0,0);
    \coordinate (end) at (2,0);

    \draw (start) .. controls (0.6,0.7) and (1.3,0.2) .. (end)
      node[sloped,inner sep=0cm,above,pos=.5,anchor=south west,
      minimum height=12](N){};

    \path (N.south west) edge[-stealth'] node[above left] 
        {$\vec{n}$} (N.north west);
    \draw (N.south west) ++ (\rightAngleRadius,-1pt) 
        arc (-20:80:\rightAngleRadius);
    \node[above right=-3pt] at (N.south west) {.};
\end{tikzpicture}
\end{document}

enter image description here

1
  • 2
    I dont’t think this question should be closed. Post the answer you found as an answer (maybe as community wiki, since it’s not your own idea) to this question and accept it …
    – Tobi
    Feb 16, 2013 at 10:22

1 Answer 1

1

As suggested in this answer, one can use the markings library to make a local coordinate system in which to draw the symbol.

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{decorations.markings,positioning}

\begin{document}

\begin{tikzpicture}[
    tangent/.style={
        decoration={
            markings,% switch on markings
            mark=
                at position #1
                with
                {
                    \coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
                    \coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
                    \coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
                }
        },
        postaction=decorate
    },
    use tangent/.style={
        shift=(tangent point-#1),
        x=(tangent unit vector-#1),
        y=(tangent orthogonal unit vector-#1)
    },
    use tangent/.default=1
]
    \coordinate (start) at (0, 0);
    \coordinate (end) at (5,2);
    \pgfmathsetmacro\rightAngleRadius{0.2}
    \draw[tangent=0.4] (start)
        to [out=20,in=120] (end);
    \draw[->, use tangent] (0,0) -- ++ (0,1);
    \draw[use tangent] (\rightAngleRadius,0) arc (0:90:\rightAngleRadius);
    \draw[use tangent] (0.4*\rightAngleRadius,0.4*\rightAngleRadius) node{.};
    \draw[use tangent,left] (0,1) node {$\vec{n}$};
\end{tikzpicture}
\end{document}

You must log in to answer this question.

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