TransWikia.com

Current Helix Wire Wrapping a Magnet Bar

TeX - LaTeX Asked by Savchenko on January 6, 2021

Could you help me draw a right/left-handed helix wrapping a cylinder? I have below provided my pstricks code which to me looks too large and complicated. My aim is to compile a fancy 3D drawing using pstricks like one attached. Thank you very much in advance.
enter image description here

documentclass[12pt]{article}
    usepackage{amssymb,amsmath}
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{xcolor}
    usepackage{pst-plot,pstricks-add,pst-solides3d,pst-3dplot}
    begin{document}
    psset{xunit=0.05textwidth, yunit=0.05textwidth}
    begin{center}
    %begin{pspicture*}[showgrid=bottom,griddots=60](-10,-1)(10,4)
    begin{pspicture*}(-10,-1)(10,4)
    
    %rput(0,3.75){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{($textcolor{red!40!black}{i}$)}}}}
    %rput(0,1.25){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{($textcolor{red!40!black}{ii}$)}}}}
    rput(-2,2.5){
    
    
    %psclip{psellipse*[linecolor=red,rot=-12.606](5,1)(3,4)}
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    
    psline[linecolor=black, linewidth=0.001textwidth](-5,0.5)(9,0.5)
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](9,0)(0.25,0.5){90}{-90}
    
    psline[linecolor=black, linewidth=0.001textwidth](9,-0.5)(-5,-0.5)
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){-90}{90}
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-5,0.5)(9,0.5)
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](9,0)(0.25,0.5){90}{-90}
    
    psline[linecolor=black, linewidth=0.001textwidth](9,-0.5)(-5,-0.5)
    
    pscustom[fillstyle=solid,fillcolor=gray!2.5,linestyle=none]{
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){0}{360}
    }
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){0}{360}
    
    psline[linecolor=gray!10, linewidth=0.001textwidth](-3.67,0.5)(-3.40,0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-4.6,-0.5)(-4.33,-0.5)
    
    rput(4,0){
    psline[linecolor=gray!10, linewidth=0.001textwidth](-3.67,0.5)(-3.40,0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-4.6,-0.5)(-4.33,-0.5)
    }
    rput(8,0){
    psline[linecolor=gray!10, linewidth=0.001textwidth](-3.67,0.5)(-3.40,0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-4.6,-0.5)(-4.33,-0.5)
    }
    rput(12,0){
    psline[linecolor=gray!10, linewidth=0.001textwidth](-3.67,0.5)(-3.40,0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-4.6,-0.5)(-4.33,-0.5)
    }
    
    
    pscustom[fillstyle=solid,fillcolor=gray!5,linestyle=none]{
    
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-5}{-4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-4}{-2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-2}{0}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{0}{2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{2}{4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{4}{6}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{6}{8}{0.72*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{8}{9}{0.78*sin(3.141592*x/2)-0.1}
    
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](9,0.75)(0.04,0.08){-90}{90}
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{9}{8}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{8}{6}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{6}{4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{4}{2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{2}{0}{0.72*sin(3.141592*x/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{0}{-2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-2}{-4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-4}{-5}{0.78*sin(3.141592*(x)/2)+0.1}
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    }
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-5}{-4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-4}{-2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-2}{0}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{0}{2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{2}{4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{4}{6}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{6}{8}{0.72*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{8}{9}{0.78*sin(3.141592*x/2)-0.1}
    
    
    psellipticarc[linewidth=0.0015textwidth,linecolor=black](9,0.75)(0.04,0.08){-90}{90}
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{9}{8}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{8}{6}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{6}{4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{4}{2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{2}{0}{0.72*sin(3.141592*x/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{0}{-2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-2}{-4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-4}{-5}{0.78*sin(3.141592*(x)/2)+0.1}
    
    pscustom[fillstyle=solid,fillcolor=gray!0,linestyle=none]{
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    }
    
    psellipticarc[linewidth=0.0015textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    
    
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-2,-0.5)(-2,-0.55)(-1,-0.55)(-1,0.5)(-1,0.5)(-2,0.5)(-2,0.55)(-3,0.55)(-3,-0.5)
    }
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)(-1,0.5)(-3,0.5)(-3,-0.5)
    }
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-1,0.5)(-3,0.5)
    
    
    rput(4,0){
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-2,-0.5)(-2,-0.55)(-1,-0.55)(-1,0.5)(-1,0.5)(-2,0.5)(-2,0.55)(-3,0.55)(-3,-0.5)
    }
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)(-1,0.5)(-3,0.5)(-3,-0.5)
    }
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-1,0.5)(-3,0.5)
    }
    
    rput(8,0){
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-2,-0.5)(-2,-0.55)(-1,-0.55)(-1,0.5)(-1,0.5)(-2,0.5)(-2,0.55)(-3,0.55)(-3,-0.5)
    }
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)(-1,0.5)(-3,0.5)(-3,-0.5)
    }
    psline[linecolor=black, linewidth=0.001textwidth](-3,-0.5)(-1,-0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-1,0.5)(-3,0.5)
    }
    
    psline[linecolor=black, linewidth=0.001textwidth,arrowscale=1.5, arrowinset=0]{->}(-6.0,-0.75)(-5.125,-0.75)
    psline[linecolor=black, linewidth=0.001textwidth,arrowscale=1.5, arrowinset=0]{->}(9.125,0.75)(10.0,0.75)
    
    rput(9.75,0){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{$mathrm{S}$}}}}
    rput(-5.75,0){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{$mathrm{N}$}}}}
    }
    
    rput(-2,0){
    
    
    %psclip{psellipse*[linecolor=red,rot=-12.606](5,1)(3,4)}
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    
    psline[linecolor=black, linewidth=0.001textwidth](-5,0.5)(9,0.5)
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](9,0)(0.25,0.5){90}{-90}
    
    psline[linecolor=black, linewidth=0.001textwidth](9,-0.5)(-5,-0.5)
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){-90}{90}
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-5,0.5)(9,0.5)
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](9,0)(0.25,0.5){90}{-90}
    
    psline[linecolor=black, linewidth=0.001textwidth](9,-0.5)(-5,-0.5)
    
    pscustom[fillstyle=solid,fillcolor=gray!2.5,linestyle=none]{
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){0}{360}
    }
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,0)(0.25,0.5){0}{360}
    
    psline[linecolor=gray!10, linewidth=0.001textwidth](-1.67,-0.5)(-1.40,-0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-2.6,0.5)(-2.33,0.5)
    
    rput(4,0)
    {
    psline[linecolor=gray!10, linewidth=0.001textwidth](-1.67,-0.5)(-1.40,-0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-2.6,0.5)(-2.33,0.5)
    }
    
    rput(8,0)
    {
    psline[linecolor=gray!10, linewidth=0.001textwidth](-1.67,-0.5)(-1.40,-0.5)
    psline[linecolor=gray!10, linewidth=0.001textwidth](-2.6,0.5)(-2.33,0.5)
    }
    
    
    pscustom[fillstyle=solid,fillcolor=gray!5,linestyle=none]{
    
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-5}{-4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-4}{-2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-2}{0}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{0}{2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{2}{4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{4}{6}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{6}{8}{0.72*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{8}{9}{0.78*sin(3.141592*x/2)-0.1}
    
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](9,0.75)(0.04,0.08){-90}{90}
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{9}{8}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{8}{6}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{6}{4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{4}{2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{2}{0}{0.72*sin(3.141592*x/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{0}{-2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-2}{-4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.001textwidth]{-4}{-5}{0.78*sin(3.141592*(x)/2)+0.1}
    
    psellipticarcn[linewidth=0.001textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    }
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-5}{-4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-4}{-2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-2}{0}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{0}{2}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{2}{4}{0.72*sin(3.141592*(x)/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{4}{6}{0.78*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{6}{8}{0.72*sin(3.141592*x/2)-0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{8}{9}{0.78*sin(3.141592*x/2)-0.1}
    
    
    psellipticarc[linewidth=0.0015textwidth,linecolor=black](9,0.75)(0.04,0.08){-90}{90}
    
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{9}{8}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{8}{6}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{6}{4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{4}{2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{2}{0}{0.72*sin(3.141592*x/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{0}{-2}{0.78*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-2}{-4}{0.72*sin(3.141592*(x)/2)+0.1}
    psplot[algebraic,plotpoints=500,linecolor=black,linewidth=0.0015textwidth]{-4}{-5}{0.78*sin(3.141592*(x)/2)+0.1}
    
    pscustom[fillstyle=solid,fillcolor=gray!0,linestyle=none]{
    
    psellipticarc[linewidth=0.001textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    }
    
    psellipticarc[linewidth=0.0015textwidth,linecolor=black](-5,-0.75)(0.04,0.08){0}{360}
    
    psline[linecolor=black, linewidth=0.001textwidth,arrowscale=1.5, arrowinset=0]{->}(-6.0,-0.75)(-5.125,-0.75)
    psline[linecolor=black, linewidth=0.001textwidth,arrowscale=1.5, arrowinset=0]{->}(9.125,0.75)(10.0,0.75)
    
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.75,0.5)(-3.75,0.55)(-3.25,0.55)(-3.25,-0.5)(-4.25,-0.5)(-4.25,-0.55)(-4.7,-0.55)(-4.7,0.5)
    }
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)(-3.25,-0.5)(-4.7,-0.5)(-4.7,0.5)
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-3.25,-0.5)(-4.7,-0.5)
    
    rput(4,0)
    {
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.75,0.5)(-3.75,0.55)(-3.25,0.55)(-3.25,-0.5)(-4.25,-0.5)(-4.25,-0.55)(-4.7,-0.55)(-4.7,0.5)
    }
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)(-3.25,-0.5)(-4.7,-0.5)(-4.7,0.5)
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-3.25,-0.5)(-4.7,-0.5)
    }
    
    rput(8,0)
    {
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.75,0.5)(-3.75,0.55)(-3.25,0.55)(-3.25,-0.5)(-4.25,-0.5)(-4.25,-0.55)(-4.7,-0.55)(-4.7,0.5)
    }
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)(-3.25,-0.5)(-4.7,-0.5)(-4.7,0.5)
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-3.25,-0.5)(-4.7,-0.5)
    }
    
    rput(12,0)
    {
    pscustom[fillstyle=solid,fillcolor=white,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.75,0.5)(-3.75,0.55)(-3.25,0.55)(-3.25,-0.5)(-4.25,-0.5)(-4.25,-0.55)(-4.7,-0.55)(-4.7,0.5)
    }
    
    pscustom[fillstyle=solid,fillcolor=gray!10,linestyle=none]{
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)(-3.25,-0.5)(-4.7,-0.5)(-4.7,0.5)
    }
    
    psline[linecolor=black, linewidth=0.001textwidth](-4.7,0.5)(-3.25,0.5)
    psline[linecolor=black, linewidth=0.001textwidth](-3.25,-0.5)(-4.7,-0.5)
    }
    
    
    
    
    rput(9.75,0){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{$mathrm{N}$}}}}
    rput(-5.75,0){{psscalebox{1}{psframebox[framesep=0.005textwidth,linestyle=none]{$mathrm{S}$}}}}
    
    
    }
    
    end{pspicture*}
    
    end{center}
    end{document}

2 Answers

object "cylindrecreux" is useless, you can simply use the object "cylindre". Here is a slightly improved version.

 documentclass[pstricks]{standalone}
 usepackage{pst-solides3d}
 begin{document}

 begin{pspicture}(-7,-5)(7,5)
 psset{viewpoint=100 60 20 rtp2xyz,Decran=100,lightsrc=viewpoint,solidmemory}
 psframe(-7,-5)(7,5)
 % helix R
 codejps{/a 1 def}% radius
 defFunction[algebraic]{HR}(t)
 {a*cos(2*t)}
 {2*t}
 {-a*sin(2*t)}
 % function derivatives (optional)
 defFunction[algebraic]{HR'}(t)
 {-2*a*sin(2*t)}
 {2}
 {-2*a*cos(2*t)}
 psSolid[object=cylindre,
 h=20,r=0.5,RotX=90,
 fillcolor=gray,action=none,
 name=C1,fcol=1 (cyan),
 ngrid=36 36](0,10,0)
 psSolid[object=courbe,
 range=-5 5,% radians
 ngrid=72 12,
 function=HR,
 fillcolor=red,
 fcol=1 (yellow),
 action=none,name=H1,
 r=0.2]%
 psSolid[object=fusion,grid,base=H1 C1]
 psSolid[object=plan,definition=normalpoint,
 args={0 10 0 [0 1 0]},name=P,action=none]
 psProjection[object=cercle,
 plan=P,
 args= 0 0 0.5,
 range=0 360]
 psSolid[object=plan,action=none,
 definition=solidface,args=H1 1,name=p1]
 psProjection[object=cercle,
 plan=p1,
 args= 0 0 0.2,
 range=0 360]
 end{pspicture}

 begin{pspicture}(-7,-5)(7,5)
 psset{viewpoint=100 60 20 rtp2xyz,Decran=100,lightsrc=viewpoint,solidmemory}
 psframe(-7,-5)(7,5)
 % helix
 codejps{/a 1 def}% radius
 defFunction[algebraic]{HL}(t)
 {a*cos(2*t)}
 {2*t}
 {a*sin(2*t)}
 % function derivatives (optional)
 defFunction[algebraic]{HL'}(t)
 {-2*a*sin(2*t)}
 {2}
 {2*a*cos(2*t)}
 psSolid[object=cylindre,
 h=20,r=0.5,RotX=90,
 fillcolor=gray,action=none,
 name=C1,fcol=1 (cyan),
 ngrid=36 36](0,10,0)
 psSolid[object=courbe,
 range=-5 5,% radians
 ngrid=72 12,
 function=HL,
 fillcolor=red,
 fcol=1 (yellow),
 action=none,name=H1,
 r=0.2]%
 psSolid[object=fusion,grid,base=H1 C1]
 psSolid[object=plan,definition=normalpoint,
 args={0 10 0 [0 1 0]},name=P,action=none]
 psProjection[object=cercle,
 plan=P,
 args= 0 0 0.5,
 range=0 360]
 psSolid[object=plan,action=none,
 definition=solidface,args=H1 1,name=p1]
 psProjection[object=cercle,
 plan=p1,
 args= 0 0 0.2,
 range=0 360]
 end{pspicture}
 end{document}

helix 3

helix 4

Correct answer by user73104 on January 6, 2021

Here is a way to draw your example with PSTricks

 documentclass[pstricks]{standalone}
 usepackage{pst-solides3d}
 begin{document}
 begin{pspicture}(-7,-5)(7,5)
 psset{viewpoint=100 60 20 rtp2xyz,Decran=100,lightsrc=viewpoint,solidmemory}
 psframe(-7,-5)(7,5)
 % helix R
 codejps{/a 1 def}% radius
 defFunction[algebraic]{HR}(t)
 {a*cos(2*t)}
 {2*t}
 {-a*sin(2*t)}
 % function derivatives (optional)
 defFunction[algebraic]{HR'}(t)
 {-2*a*sin(2*t)}
 {2}
 {-2*a*cos(2*t)}
 psSolid[object=cylindrecreux,
 h=20,r=0.5,RotX=90,
 fillcolor=gray,action=none,
 name=C1,
 ngrid=36 36](0,10,0)
 psSolid[object=courbe,
 range=-5 5,% radians
 ngrid=72 12,
 function=HR,
 fillcolor=red,
 action=none,name=H1,
 r=0.2]% 
 psSolid[object=fusion,grid,base=H1 C1]
 composeSolid
 end{pspicture}

 begin{pspicture}(-7,-5)(7,5)
 psset{viewpoint=100 60 20 rtp2xyz,Decran=100,lightsrc=viewpoint,solidmemory}
 psframe(-7,-5)(7,5)
 % helix
 codejps{/a 1 def}% radius
 defFunction[algebraic]{HL}(t)
 {a*cos(2*t)}
 {2*t}
 {a*sin(2*t)}
 % function derivatives (optional)
 defFunction[algebraic]{HL'}(t)
 {-a*sin(2*t)}
 {2}
 {a*cos(2*t)}
 psSolid[object=cylindrecreux,
 h=20,r=0.5,RotX=90,
 fillcolor=gray,action=none,
 name=C1,
 ngrid=36 36](0,10,0)
 psSolid[object=courbe,
 range=-5 5, % radians
 ngrid=72 12,
 function=HL,
 fillcolor=red,
 action=none,name=H1,
 r=0.2]%
 psSolid[object=fusion,grid,base=H1 C1]
 composeSolid
 end{pspicture}
 end{document}

helix R

helix L

Answered by user73104 on January 6, 2021

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