0

I have to draw a tube, aligned along a sine wave in the (x,y) plane. The length and radius of the tube is known. I have read in the Wikipedia page https://en.wikipedia.org/wiki/Channel_surface that this surface is called a "pipe" surface and that the parametric equations are given in the 3D space by

x=x(u,v)=c(u)+R*(e1(u)cos(v)+e2(u)sin(v))

where r is the radius of the pipe, u->c(u) is the parametric equation of the curve, (e1(u),e2(u)) two vectors forming a basis of the normal plane at c(u) and v is the parameter of the circle (from 0 to 2*pi).

How can I apply this for a sinus curve in the plane and plot the resulting surface with Scilab ?

Stéphane Mottelet
  • 2,853
  • 1
  • 9
  • 26
  • 1
    This question was asked by a new user and closed. Despite its editing, it has been deleted. Since I think the answer could be interesting for Scilab users, I reposted the edited question above (I think that the above form now meets Stackoverflow standards). – Stéphane Mottelet Sep 06 '22 at 12:38

1 Answers1

0

If the curve is defined by u->c(u)=(u,sin(u),0), then the vectors of the normal plane can be defined by e1(u)=(cos(u),-1,0)/sqrt(1+cos(u)^2) and e2=(0,0,1). The following code draws a tube of radius 0.5 along u->c(u) for u in [0,2*pi]:

[u,v]=meshgrid(linspace(0,2*%pi,40),linspace(0,2*%pi,40));

r=0.5;
cu=cos(u);
d=sqrt(1+cos(u).^2);

clf
mesh(u+r*cos(v).*cu./d,sin(u)-r*cos(v)./d, r*sin(v));
isoview("on")

enter image description here

Stéphane Mottelet
  • 2,853
  • 1
  • 9
  • 26