tdplotsetcoord 长度尺度

tdplotsetcoord 长度尺度

我正在尝试定义也指定Xxy,Xxz,Xyz普通坐标等的动态坐标。但是,这种坐标的长度尺度似乎与我的坐标系不同。

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{arrows.meta,decorations.markings}
\begin{document}
\begin{tikzpicture}[cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm]
\draw[-{Classical TikZ Rightarrow[scale=1.2]},very thick] (-2,0,0) -- (5,0,0) node[anchor=north,xshift=-3pt] {$x$}; 
\draw[-{Classical TikZ Rightarrow[scale=1.2]},very thick] (0,-2,0) -- (0,5,0) node[anchor=west] {$y$};
\draw[-{Classical TikZ Rightarrow[scale=1.2]},very thick] (0,0,-2) -- (0,0,5) node[anchor=south] {$z$};
\tdplotsetcoord{X}{1}{2}{3}
\coordinate (Y) at (1,2,3);
\draw[-{Stealth[scale=1.5,width=3pt]},color=gray,semithick] (O,0,0) -- (X);
\draw[dashed,color=red] (O,0,0) -- (Xxy);
\end{tikzpicture}
\end{document}

我希望X坐标与坐标位于同一位置Y,以相同的方式定义(1,2,3)
如果它放置在极坐标系中,是否存在任何转换宏或其他方式来Xxy,Xxz,Xyz用笛卡尔坐标进行定义?还是我必须自己创建转换?

答案1

\tdplotsetcoord这是tikz-3dplot包裹

\newcommand{\tdplotsetcoord}[4]{%
%
%do some trig to determine angular part of coordinate
\tdplotsinandcos{\sinthetavec}{\costhetavec}{#3}%
\tdplotsinandcos{\sinphivec}{\cosphivec}{#4}%
\tdplotmult{\stcpv}{\sinthetavec}{\cosphivec}%
\tdplotmult{\stspv}{\sinthetavec}{\sinphivec}%
%
%assign the point
\coordinate (#1) at ($#2*(\stcpv,\stspv,\costhetavec)$);
%assign the xy, xz, and yz projections of the point
\coordinate (#1xy) at ($#2*(\stcpv,\stspv,0)$);
\coordinate (#1xz) at ($#2*(\stcpv,0,\costhetavec)$);
\coordinate (#1yz) at ($#2*(0,\stspv,\costhetavec)$);
%assign the x, y, and z projections of the point
\coordinate (#1x) at ($#2*(\stcpv,0,0)$);
\coordinate (#1y) at ($#2*(0,\stspv,0)$);
\coordinate (#1z) at ($#2*(0,0,\costhetavec)$);
}

要使用笛卡尔坐标,您可以使用

\newcommand{\tdplotsetcoordcart}[4]{%
%assign the point
\coordinate (#1) at (#2,#3,#4);
%assign the xy, xz, and yz projections of the point
\coordinate (#1xy) at (#2,#3,0);
\coordinate (#1xz) at (#2,0,#4);
\coordinate (#1yz) at (0,#3,#4);
%assign the x, y, and z projections of the point
\coordinate (#1x) at (#2,0,0);
\coordinate (#1y) at (0,#3,0);
\coordinate (#1z) at (0,0,#4);
}

相关内容