Quantcast
Channel: water inside 3D tube - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

water inside 3D tube

$
0
0

a tube with water molecules inside

How can I generate the above image using TikZ. The oval inside tube represents water and arrows indicates the dipole orientation of water.What I was able to get so far is pasted below.

\documentclass{article}\usepackage{tikz}\usepackage{tikz-3dplot}%%%<\usepackage{verbatim}\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{5pt}%%%%>\begin{document}\tdplotsetmaincoords{30}{10}\tikzset{every circle/.append style={x=1cm, y=1cm}}\begin{tikzpicture}[tdplot_main_coords, rotate=90]% --- Independent parameters ---\pgfmathtruncatemacro\tA{3600}      % 10 turns 360 degree x 10=3600\def\zA{1}                         % A begin point, define the length of cylinder \pgfmathtruncatemacro\tB{30}      % tB end of turn \def\zB{5}                         % B end point\pgfmathtruncatemacro\NbPt{130}     % number of circles for drawing the helix portion 13 times 10 turns =130\def\rhelixdots{0.14}              % radius of circles  forming helix % --- Draw helix ---\pgfmathsetmacro\tone{\tA}\pgfmathsetmacro\tlast{\tB}\pgfmathsetmacro\ttwo{\tone+(\tlast-\tone)/(\NbPt-1)}\pgfmathsetmacro\p{360*(\zB-\zA)/(\tB-\tA)}\foreach \t in {\tone,\ttwo,...,\tlast}{%\pgfmathtruncatemacro{\shadingcolor}{40*sin(\t+180)+80}\shade[ball color=blue!\shadingcolor] ({0.7*cos(\t)},{0.7*sin(\t)},{\p*(\t-\tA)/360+\zA}) circle[radius=\rhelixdots];\shade[ball color=red!\shadingcolor] ({0.7*cos(\t)},{0.7*sin(\t)},{\p*(\t-\tA)/360+\zA+0.2}) circle[radius=\rhelixdots];}\end{tikzpicture}\end{document}

enter image description here

Looking for help, please have a look as well to this post Changing the view angle distort 3d tube image


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>