TikZ:当我想从原点以外的点引用时,节点放置出现问题

TikZ:当我想从原点以外的点引用时,节点放置出现问题
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
every label/.append style = {font = \scriptsize},
dot/.style = {inner sep = +0pt, shape = circle,
  draw = black, label = {#1}},
small dot/.style = {minimum size = .05cm, dot = {#1}},
big dot/.style = {minimum size = .1cm, dot = {#1}},
]
\node[fill = black, big dot = {below left: \(F\)}] (F) at (2, 0) {};
\node[fill = black, big dot = {above left: \(A\)}] (A) at (2, 0) -- ++({2 * cos(45)}, {3 * sin(45)}) {};
\end{tikzpicture}
\end{document}

我希望我的节点与点成 45 度角(2, 0),而不是与原点成 45 度角。我该怎么做?

根据 Jakes 的评论,节点放置正确,但点的大小不正确。

 \path (2, 0) -- ++({2 * cos(45)}, {3 * sin(45)})
 node[fill = black, big dot = {above right: \(A\)}] (A) {x};

在此处输入图片描述

通过删除{x}Qrrbrbirlbel 所建议的,Jakes 的评论完美地发挥了作用。

 \path (2, 0) -- ++({2 * cos(45)}, {3 * sin(45)})
 node[fill = black, big dot = {above right: \(A\)}] (A) {};

答案1

您可以使用shift坐标选项里面的选项,这与添加坐标相同。

除了({2 * cos(45)}, {3 * sin(45)}),我还使用了极坐标:(45:3 and 2)X半径是强制性的,因此如果您在宏中保存了半径,则需要执行(45:{\xr} and \yr)(45:\xr\space and \yr)

没有区别

([shift=(F)] 45:3 and 2)

([shift=(45:3 and 2)] F)

如果您想要放置一堆相对于的节点F,您可以使用scope

\begin{scope}[shift=(F)]
     % many \nodes
\end{scope}

或者 — 如我的示例一样 — 将 shift 指定为路径的一个选项(请记住,\node只需扩展为\path node):

\path[shift=(F)] \foreach \Angle in {90,135,...,360} {
                                    node[big dot={\Angle:\Angle}] at (\Angle:3 and 2) {}};

如果你加载了calc库,你还可以这样做

($(F)+(45:3 and 2)$)

代码

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[
  every label/.append style = {font = \scriptsize},
  dot/.style = {inner sep = +0pt, shape = circle,
    draw = black, label = {#1}},
  small dot/.style = {minimum size = .05cm, dot = {#1}},
  big dot/.style = {minimum size = .1cm, dot = {#1}},
]
\node[fill = blue,  big dot = {below:      \(O\)}] (O) at (0,0) {};
\node[fill = black, big dot = {below left: \(F\)}] (F) at (2, 0) {};
\node[fill = black, big dot = {above left: \(A\)}] (A) at ([shift=(F)] 45:3 and 2) {};
\path[shift=(F)] \foreach \Angle in {90,135,...,360} {
                                    node[big dot={\Angle:\Angle}] at (\Angle:3 and 2) {}};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

相关内容