7

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:

enter image description here

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);
}

enter image description here

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.

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

1 Answer 1

5

A single cubic Bézier segment is parameterized from 0 to 1 and has 4 control points. Your path is generated by sampling f at ngraph=100 (in graph_settings.asy) points, which generates a path3 of length 25, parameterized from 0 to 25.

2
  • 1
    Thanks John for explanation. But with the documentation we can expect a relative point behavior ?
    – O.G.
    Commented Dec 16, 2019 at 16:30
  • I think the document should be updated. I suggest OP wrire an issue in Asymptote' github site.
    – ollydbg23
    Commented Dec 25, 2019 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .