答案1
这是带有模块的 Asymptote 解决方案tube
。我选择的brown+gray
是铜线的颜色。您可以随意更改为其他颜色,例如https://colorcodes.io/brown/copper-color-codes/
// Run on http://asymptote.ualberta.ca/
// adapted from http://www.piprime.fr/files/asymptote/tube/
import tube;
import graph3;
size(10cm,0);
currentprojection=orthographic(0,4,0,zoom=.8,center=true);
real x(real t) {return .03*t;}
real y(real t) {return .5cos(t);}
real z(real t) {return .5sin(t);}
real tmin=0,tmax=40pi;
triple A=(x(tmin)-.5,y(tmin),z(tmin));
triple B=(x(tmax)+.5,y(tmax),z(tmax));
path3 p=A--graph(x,y,z,0,36pi,operator ..)--B;
path section=scale(.05)*unitcircle;
// Define a pen wich depends of a real t. t represent the "reltime" of the path3 p.
pen pen(real t){return brown+gray;}
// Here the section has colored segments (by default) depending to reltime.
draw(tube(p,coloredpath(section,pen)));