任意曲线的递归弧长重新参数化

时间:2019-03-14 02:24:19

标签: functional-programming numerical-methods openscad parametric-equations

我有一条3D参数曲线,定义为 P(t)= [x(t),y(t),z(t)]

我正在寻找一种功能,可以根据弧长重新设置此曲线的参数。我正在使用OpenSCAD,这是一种没有变量的声明性语言(仅常数),因此该解决方案需要递归工作(除了全局常量和函数参数之外,没有变量)。

更确切地说,我需要编写一个函数 Q ,该函数给出 P 上的点(大约)为 s t = 0 点开始沿弧线。我已经有用于数字积分和微分的函数,可以将其合并到答案中。

任何建议将不胜感激!

p.s在OpenSCAD中不可能将函数作为参数传递,我通常仅通过使用全局声明来解决此问题。

1 个答案:

答案 0 :(得分:2)

The length of an arc sigma between parameter values t=0 and t=T can be computed by solving the following integral:

sigma(T) = Integral[ sqrt[ x'(t)^2 + y'(t)^2 + z'(t)^2 ],{t,0,T}]

If you want to parametrize your curve with the arc-length, you have to invert this formula. This is unfortunately rather difficult from a mathematics point of view. The simplest method is to implement a simple bisection method as a numeric solver. The computation method quickly becomes heavy so reusing previous results is ideal. The secant method is also useful as the derivative of sigma(t) is already known and equals

sigma'(t) = sqrt[ x'(t)^2 + y'(t)^2 + z'(t)^2]

Maybe not really the most helpful answer, but I hope it gives you some ideas. I cannot help you with the OpenSCad implementation.