Evenly space points along a parametric curve?
Are there arc-length parametrization functions hidden somewhere in Sage? I have some 3D parametric curves (smooth) of length L
along which I would like to put n
dots at regular intervals. What I've been doing so far is using numerical integration to find the arc length parameter, and then using find_root
to find the positions of the dots (spaced by arc length L/n
).
This is pretty slow, and has the further limitation that I need to specify a region on which find_root
should work. If the parametrization is really uneven, it's tough to develop a good initial estimate for where to look.
So, does anyone have other ideas for doing this? Thanks!
UPDATE: Here are some examples -- they're different fibers in the Hopf fibration, and are given by r = (rx,ry,rz)
Example 1:
rx(t) = -0.309*cos(t)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.570)^2 + 1)*pi)
ry(t) = -0.309*sin(t)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.57)^2 + 1)*pi)
rz(t) = 0.951*sin(-t - 1.57)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.57)^2 + 1)*pi)]
Example 2:
rx(t) = -0.707*cos(t)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
ry(t) = -0.707*sin(t)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
rz(t) = 0.707*sin(-t - 1.57)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
Could you give an example of a typical curve that you're considering?
Unless a given curve has special properties (say, an ellipse) I don't know that there is a better way in general. Would it work for your needs if we did it this way but faster?
sure, faster would definitely be good. I tried writing some cython functions myself, but couldn't really get speed improvements.