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.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc, arrows, intersections}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45,
    fixed point arithmetic]
    \coordinate (P1) at (-2, 0);
    \coordinate (P2) at (2.5, 0);
    \coordinate (P3) at (2, 0);

    \draw (P1) -- (P2);
    \draw[red] (P3) circle (.1cm);
    \path[name path = line] (P1) -- (70: 4.5cm and 2.5cm);
    \path[name path = arc] (P3) arc (0:70: 4cm and 2cm) coordinate (P4);
    \path[name intersections = {of = line and arc, by = P4}];

    \begin{scope}
      \clip (P4) rectangle (P3);
      \draw (P3) arc (0:70: 4cm and 2cm);
    \end{scope}

    \draw[-latex] (P1) -- (P4) node[above, scale = .75, pos = .5, fill = white,
    inner sep = 0cm] {\(\mathbf{r}\)};

    \draw[orange] let
      \p1 = (P1),
      \p3 = (P3),
      \p4 = (P4),
      \n1 = {atan2(\x3 - \x1, \y3 - \y1)},
      \n2 = {atan2(\x4 - \x1, \y4 - \y1)},
      \n3 = {.75cm}
    in (P1) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
    node [scale = .75, shift = {(.5cm, -.25cm)}] {\(\nu\)};

    \path[name path = aux] (P4) circle [radius = 1bp];

    \draw[name intersections = {of = arc and aux}, -latex] (P4) --
    ($(intersection-2)!1cm!(intersection-1)$);
    \draw[-latex] (P4) -- ($(P4)!1cm!-90:(P1)$);
\end{tikzpicture}
\end{document}

enter image description here

How can I extend the line tangent to the end of the arc to the length of the perpendicular line? I know I could make another perpendicular \path at the end of the first perpendicular line, then run a longer tangential \path, mark the intersection, and change my tangential line to that new marked intersection. However, there has to be a better way.

share|improve this question
    
@Jake I forgot to copy this over: \draw[-latex] (P4) -- ($(P4)!1cm!-90:(P1)$); I will add it to the OP –  dustin Jun 27 '13 at 3:47
    
Does the length of the perpendicular arrow have to be fixed, or would you also be happy with a solution where you fix the length of the tangential arrow and make the length of the perpendicular arrow depend on that? –  Jake Jun 27 '13 at 4:17
    
@Jake either is fine. –  dustin Jun 27 '13 at 4:22
add comment

1 Answer

up vote 4 down vote accepted

If you name the coordinate at the end of the tangential arrow (P5), you can use the calc library's projection syntax to draw the perpendicular arrow to the correct length.

Using the projection syntax, the expression

($(A)!(C)!(B)$)

describes the projection of C on the line from A to B. This can be combined with the rotation syntax:

($(A)!(C)!90:(B)$)

describes the projection of C on the line from A to B, after that line has been rotated around A by 90 degrees.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, arrows, intersections}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45]
    \coordinate (P1) at (-2, 0);
    \coordinate (P2) at (2.5, 0);
    \coordinate (P3) at (2, 0);

    \path[name path = line] (P1) -- (70: 4.5cm and 2.5cm);
    \path[name path = arc] (P3) arc (0:70: 4cm and 2cm) coordinate (P4);
    \path[name intersections = {of = line and arc, by = P4}];

    \begin{scope}
      \clip (P4) rectangle (P3);
      \draw (P3) arc (0:70: 4cm and 2cm);
    \end{scope}

    \draw[-latex] (P1) -- (P4);
    \path[name path = aux] (P4) circle [radius = 1bp];

    \draw[name intersections = {of = arc and aux}, -latex] (P4) --
    ($(intersection-2)!1.2cm!(intersection-1)$) coordinate (P5);
    \draw[-latex] (P4) -- ($(P4)!(P5)!-90:(P1)$);

\end{tikzpicture}
\end{document}
share|improve this answer
    
I knew there had to be an easier way then what I was going to do. –  dustin Jun 27 '13 at 4:27
add comment

Your Answer

 
discard

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

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