TransWikia.com

tdplotsetcoord length scale

TeX - LaTeX Asked by user46581 on August 2, 2020

I’m trying to define that dynamic coordinate which specifies also Xxy,Xxz,Xyz plain coordinates etc. However, such coordinate seems to be with different length scale than my coordinate system is.

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}

I would like X coordinate to be at same place as Y coordinate, defined the same way (1,2,3).
If it is placed in polar coord. system, does there exist any transformation macro or another way to define Xxy,Xxz,Xyz with Cartesian coordinates? Or do I have to create the transformation myself?

One Answer

This is the source of tdplotsetcoord

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)$);
}

To use cartesian coordinates, you can use

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 (#1xz) 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);
}

Answered by Eric on August 2, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP