TransWikia.com

parallel lines in tikz

TeX - LaTeX Asked on December 26, 2020

I have this code of two lines and I want to plot two parallel lines to those lines and then connet the opposite corners together .. is there a simple way to do it

documentclass{article}
usepackage{tikz}   %TikZ is required for this to work.  Make sure this exists before the next line

usepackage{tikz-3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation

usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
PreviewEnvironment{tikzpicture}
setlengthPreviewBorder{2mm}

begin{document}
tdplotsetmaincoords{60}{110}
pgfmathsetmacro{rvec}{.8}
pgfmathsetmacro{thetavec}{30}
pgfmathsetmacro{phivec}{60}
begin{tikzpicture}[scale=5,tdplot_main_coords]
coordinate (O) at (0,0,0);
draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
draw[-stealth,thick] (O) -- (P);
draw[-stealth,thick] (O) -- (Pxy);
tdplotdrawarc{(O)}{0.2}{0}{phivec}{anchor=north}{$phi$}
tdplotsetthetaplanecoords{phivec}
tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.5}{0}{thetavec}{anchor=south west}{$theta$}
tdplotsetrotatedcoords{phivec}{thetavec}{0}
tdplotsetrotatedcoordsorigin{(P)}  
tdplotsetrotatedthetaplanecoords{45}
end{tikzpicture}

end{document}

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