# The "transform" parameter of tube in Asymptote

From the doc of tube:

surface tube(path3 g, coloredpath section, transform T(real)=new transform(real t) {return identity();}, real corner=1, real relstep=0);

draws a tube along g with cross section section, after applying the transformation T(t) at relpoint(g,t).

However, when I run this code:

``````import tube;
import graph3;
size(5cm,0);
currentprojection = orthographic(4,4,14);

triple f(real x){
return (x, x*x, 0);
}

path3 p = graph(f, -1, 1, operator ..);

transform T(real t){
return scale(t*(1-t)/500);
}

draw(tube(p, unitcircle, T), purple);

draw(shift(relpoint(p,0))*scale3(0.1)*unitsphere, black);
draw(shift(relpoint(p,1))*scale3(0.1)*unitsphere, green);
``````

I get: That sounds strange to me. Since `T(0) = T(1) = scale(0)`, I expected a 0 diameter at both endpoints of the path, but this is not what I get at `relpoint(p,1)` (the green point).

It seems that I get the expected result when I do:

``````transform T(real t){
return scale(t*(25-t)/500);
}
`````` That would mean that `t` runs from 0 to 25 in `T`.

Does `t` really runs from 0 to 25? Why 25? What am I misunderstanding?

I'm using Asymptote version 2.44.

• Looks like the magic number is n/4 where n is the number of points of the path. Dec 13, 2019 at 18:31

• Thanks John for explanation. But with the documentation we can expect a `relative point` behavior ?