另一种方式

另一种方式

我想画一个圆,P = (-2.75,0.75)使矩形的顶点A = (0,0)位于圆周上,我想画一个圆P,半径等于P和之间距离的两倍A。我尝试使用代码

 \draw[green, dashed, name path=another_path_to_locate_R] let \p1=($(P)-(0,0)$) in (P) circle (2*{veclen(\x1,\y1)});

 \draw[green, dashed, name path=another_path_to_locate_R] let \p1=($(P)-(0,0)$) in (P) circle ($2*{veclen(\x1,\y1)}$); .

我遇到了错误

\documentclass{amsart}


\usepackage{tikz}
 \usetikzlibrary{calc,positioning,intersections,quotes}


\begin{document}


\begin{tikzpicture}


\noindent \hspace*{\fill}
\begin{tikzpicture}


\coordinate (A) at (0,0);


\coordinate (P) at (-2.25,0.75);

\draw[name path=another_circle_about_P] let \p1=($(P)-(0,0)$) in (P) circle ({veclen(\x1,\y1)});
 %\draw[green, dashed, name path=another_path_to_locate_R] let \p1=($(P)-(0,0)$) in (P) circle ($2*{veclen(\x1,\y1)}$);

\end{tikzpicture}

\end{document}

答案1

只需删除美元符号,然后移至*之前即可veclen

在此处输入图片描述

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (P) at (-2.25,0.75);
\draw[name path=another_circle_about_P] let \p1=($(P)-(0,0)$) in (P) circle ({veclen(\x1,\y1)});
\draw[green, dashed, name path=another_path_to_locate_R] let \p1=($(P)-(0,0)$) in (P) circle ({2*veclen(\x1,\y1)});
\end{tikzpicture}
\end{document}

另一种方式

一个相当简单的方法是借助through库来绘制一个围绕一个点并经过另一个点的圆。它定义了一个键,circle through并完成了这项工作。

第二个圆圈是使用库let中的绘制的calc

在此处输入图片描述

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{through,calc}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (P) at (-2.25,0.75);
\fill (A) circle[radius=2pt] (P) circle[radius=2pt];
\node [draw,circle through={(A)}] at (P) {};
\draw
let
 \p1=(A), \p2=(P), \n1={2*veclen(\y2-\y1,\x2-\y1)}
in
(P) circle[radius=\n1];
\end{tikzpicture}
\end{document}

相关内容