我怎样才能使下图中标有“ds”的箭头的线段真正到达箭头点?我使用箭头附近的坐标伪造了它,但看起来很糟糕。
所讨论的线段是
\draw (sigma002) -- (ds) node [midway, above, sloped] (EdgeBC) {\huge $r-r'$};
\draw (ds) -- (origin) node [midway, left] (EdgeCA) {\huge $r$};
编辑:我可以用
\coordinate (ds) at ($(-1,0)+(158:0.8 and 2)$);
但我想知道我是否可以以某种方式标记箭头,以便我可以参考它,而不是摆弄度数。
整个代码是
\documentclass[tikz]{standalone} % Font size (can be 10pt, 11pt or 12pt) and paper size (remove a4paper for US letter paper)
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage[european resistor, european voltage, european current]{circuitikz}
\usetikzlibrary{arrows,shapes,positioning}
\usetikzlibrary{decorations.markings,decorations.pathmorphing,
decorations.pathreplacing}
\usetikzlibrary{calc,patterns,shapes.geometric}
\usepackage[backend=bibtex]{biblatex}
\begin{document}
\begin{tikzpicture}[axis/.style={thick,->}]
\begin{scope}[scale=2]
\coordinate (O) at (2, -4, 0);
\draw[axis] (O) -- +(1, 0, 0) node [right] {$X$};
\draw[axis] (O) -- +(0, 1, 0) node [right] {$Y$};
\draw[axis] (O) -- +(0, 0, 1) node [above] {$Z$};
\coordinate (origin) at (2,-4,0);
\end{scope}
\begin{scope}[yshift=15cm,xshift=-1cm,y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
\draw (480,650) node [left] {\huge $\Omega$};
\path[draw=black,line join=miter,line cap=butt,even odd rule,line width=0.652pt]
(484.9568,435.1993) .. controls (484.9568,435.1993) and (599.0510,425.7490) ..
(496.9338,527.8977) .. controls (423.2250,601.6293) and (567.8460,666.1913) ..
(508.4049,681.9064) .. controls (448.9638,697.6216) and (314.0241,802.7694) ..
(305.6815,721.0505) .. controls (297.3389,639.3316) and (159.7951,715.9228) ..
(195.2512,646.7760) .. controls (230.7073,577.6292) and (204.9425,339.3156) ..
(268.5549,410.0339) .. controls (326.9830,454.7585) and (450.7616,447.3561) ..
(484.9568,435.1993) -- cycle;
\end{scope}
\begin{scope}[scale=1.75,xshift=4.5cm,yshift=-0.8cm,
cube/.style={very thick,black},
grid/.style={very thin,gray},
axis/.style={->,blue,ultra thick},
rotated axis/.style={->,purple,ultra thick}]
%draw the top and bottom of the cube
\draw[cube,fill=blue!5] (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle;
%draw the top and bottom of the cube
\draw[cube,fill=red!5] (0,0,0) -- (0,2,0) -- (0,2,2) -- (0,0,2) -- cycle;
%draw the top and bottom of the cube
\draw[cube,fill=green!5] (0,0,0) -- (2,0,0) -- (2,0,2) -- (0,0,2) -- cycle;
\foreach \x in {0,1,2}
\foreach \y in {0,1,2}
\foreach \z in {0,1,2}{
%#####################################################
\ifthenelse{ \lengthtest{\x pt < 2pt} }
{
% True
\draw [black] (\x,\y,\z) -- (\x+1,\y,\z);
}
{% False
}
%#####################################################
\ifthenelse{ \lengthtest{\y pt < 2pt} }
{
% True
\draw [black] (\x,\y,\z) -- (\x,\y+1,\z);
}
{% False
}
%#####################################################
\ifthenelse{ \lengthtest{\z pt < 2pt} }
{
% True
\draw [black] (\x,\y,\z) -- (\x,\y,\z+1);
}
{% False
}
\shade[rotated axis,ball color = black!80] (\x,\y,\z) circle (0.06cm);
}
\coordinate (sigma002) at (0,0,2);
\end{scope}
\begin{scope}
\tikzstyle arrowstyle=[scale=2] %Taille de la flèche
\draw[thick, black, postaction={decorate,decoration={markings,mark=at position .42 with {\arrow[arrowstyle]{stealth}}}}](-1,0) ellipse (0.8cm and 2cm);
\draw (-2,1) node [left] {\huge $ds$};
\coordinate (ds) at (-1.58,1);
\end{scope}
\draw (origin) -- (sigma002) node [midway, right] (EdgeAB) {\huge $r'$};
\draw (sigma002) -- (ds) node [midway, above, sloped] (EdgeBC) {\huge $r-r'$};
\draw (ds) -- (origin) node [midway, left] (EdgeCA) {\huge $r$};
\begin{scope}[scale=1.75,xshift=4.5cm,yshift=-0.8cm,
cube/.style={very thick,black},
grid/.style={very thin,gray},
axis/.style={->,blue,ultra thick},
rotated axis/.style={->,purple,ultra thick}]
\draw (0,0,2.25) node [left] {\huge $\sigma(r')$};
\end{scope}
\end{tikzpicture}
\end{document}
答案1
好吧,现在没有反复试验方法:
在\arrow
装饰中添加箭头的坐标,方法如下:
\begin{scope}
\tikzstyle arrowstyle=[scale=2] %Taille de la flèche
\draw[thick, black,
postaction={decorate,
decoration={markings,mark=at position 0.42 with {\arrow[arrowstyle]{stealth}
\coordinate[label=left:\huge$ds$] (ds) {}; %<-- added
}}}] (-1,0) ellipse (0.8cm and 2cm);
%\draw (-2,1) node [left] {\huge };
\end{scope}
并删除该坐标的旧手动设置。这应该可以巧妙的 TikZ 技巧... 如你所见,我还将带有$ds$的节点的内容移动到坐标中作为标签。