与“使用”命令相关的协调问题

与“使用”命令相关的协调问题

在 MWE 中,点 P 和 M 是相同的,尽管它们由不同的坐标定义(分别由(0,0)(0,3))。 (我的目标是在蓝色极点上定义一个点 M,它应该与接触点 P 不同,并且位于椭圆内。)

看起来似乎\coordinate[use tangent] (M) at (0,3);不能正常工作,但是可以(0,0)

切线定义来自如何制作椭圆的切线以及与其平行的线?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\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
  ]
  \def\a{4} % major half axis
  \def\b{2} % minor half axis
  \draw[thick, tangent=0.35] (0,0) ellipse ({\a} and {\b});
  %polar
  \draw [blue, thick, use tangent] (0,3) -- (0,-2);
  \coordinate[use tangent] (P) at (0,0);
  \coordinate[use tangent] (M) at (0,3);
  \filldraw (P) circle (2pt);
  \node[left] at (P) {$P$};
  \node[right] at (M) {$M$};
 \end{tikzpicture}
\end{document}

图像

答案1

在此处输入图片描述

每次你想use tangent切线框架(正确的名称应该是 Frenet 框架)。我使用 ; 重写了您的代码scope,我认为这样更容易理解。

代码

\documentclass[margin=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{intersections}

\begin{document}
\tikzset{
  tangent/.style={
    decoration={
      markings,% switch on markings
      mark=at position #1 with {
        \coordinate (tangent point-%
        \pgfkeysvalueof{/pgf/decoration/mark info/sequence number})
        at (0, 0);
        \coordinate (tangent vector-%
        \pgfkeysvalueof{/pgf/decoration/mark info/sequence number})
        at (1, 0);
        \coordinate (normal vector-%
        \pgfkeysvalueof{/pgf/decoration/mark info/sequence number})
        at (0, 1);
      }
    },
    postaction=decorate
  },
  use tangent/.style={
    shift=(tangent point-#1),
    x=(tangent vector-#1),
    y=(normal vector-#1)
  },
  use tangent/.default=1
}
  
\def\a{4} % major half axis
\def\b{2} % minor half axis

\begin{tikzpicture}
  \draw[thick, tangent=0.3] (0, 0) ellipse ({\a} and {\b});
  
  % polar
  \begin{scope}[use tangent]
    \draw [blue, thick] (0, 3) -- (0, -1);
    \draw[fill=white]
    (0, 0) coordinate (P) circle (2pt) node[above left] {$P$}
    (0, 3) coordinate (M) circle (2pt) node[below right] {$M$};
  \end{scope}
\end{tikzpicture}
\end{document}

相关内容