回旋曲线的参数化函数 [英] Parameterized function for clothoid

查看:14
本文介绍了回旋曲线的参数化函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为道路网络编写渲染器,它基于 RoadXML 格式.>

这种格式的道路曲线有四种类型:

  • 段,
  • 圆弧,
  • 折线,
  • clotho arc.

我对最后一个有问题.

Clothoid 与 Euler 螺旋和 Cornu 螺旋相同.在 RoadXML 中,布料弧由三个参数给出:

  • 开始曲率,
  • 末端曲率,
  • 长度.

对于弧三角测量,我需要一个像 foo(t) 这样的函数,它返回 t = 0..length 的 (x, y) 坐标.我为圆弧创建了类似的方法没有问题,但我不能为clotho arc做.

部分问题是我不完全理解如何在标准回旋曲线公式中应用开始和结束曲率参数.

例如,示例 RoadXML 道路.RoadXML 示例 http://img560.imageshack.us/img560/8172/bigroandabout.png

这是红色椭圆中的服装曲线项目.它的参数:

  • 起始曲率 = 0,
  • 末端曲率 = -0.0165407,
  • 长度 = 45.185.

我不知道如何实现这些参数,因为从0到-0.0165的回旋曲率非常直.

如果你给我这个函数的代码(C++、C#、Java、Python 或伪代码)或只是一个公式,我会很高兴.

这是我的方程式:

x(t) ≈ t,y(t) ≈ (t^3)/6,其中长度 = t = s = 曲率.x(-0.0165) = -0.0165,y(-0.0165) = -7.48688E-07.布料长度 = 0.0165,源长度 = 45.185.

缩放坐标:

x'(l) = x/clotho_length * source_length = 45.185,y'(l) = y/clotho_length * source_length = 5.58149E-07 ≈ 0.x'(0) = 0,y'(0) = 0.

因此我得到 (0, 0)...(45, 0) 分,这是非常直接的.

我的错误在哪里?我做错了什么?

解决方案

让我们看看.您的数据是:

起始曲率=0,直线,R=INF末端曲率 = -0.0165407,圆弧,R_c = 1/k_c = 60.4569335长度 = 45.185.沿回旋曲线的距离,s_c = 45.185

根据维基百科文章

R s = const = R_c s_c ( s ~ k = 1/R 根据回旋曲线的定义)d(s) = R d(theta)d(theta) = k d(s)d(theta)/d(s) = 1/R = k = s/R_c s_ctheta = s^2/2 R_c s_c = (s/a)^2 = s/2 R = k s/2在哪里 ___________________a = sqrt(2 R_c s_c) (... = 73.915445)~~~~~~~~~~~~~~~~~~~所以 theta_c = k_c s_c/2 (... = 0.37369576475 = 21.411190 度)(毕竟不是那么平坦!!)

(注意:我在此处称 a 是 WP 文章所称的 a 的倒数).那么,

d(x) = d(s) cos(theta)d(y) = d(s) sin(theta)x = INT[s=0..s] cos(theta) d(s)= INT[s=0..s] cos((s/a)^2) a d(s/a)= a INT[u=0..(s/a)] cos(u^2) d(u) = a C(s/a)y = a INT[u=0..(s/a)] sin(u^2) d(u) = a S(s/a)

其中 C(t)S(t)菲涅耳积分.

所以这就是您进行缩放的方式.不仅仅是t = s,还有t = s/a = sqrt(theta).这里,对于终点,t_c = sqrt( k_c s_c/2) = sqrt( 0.0165407 * 45.185/2) = 0.6113066.

现在,WolframAlpha 说{73.915445 Sqrt[pi/2] FresnelC[0.6113066/Sqrt[pi/2]], 73.915445 Sqrt[pi/2] FresnelS[0.6113066/Sqrt[pi/2]]} = {44.5581, 5.57259}.(显然 Mathematica 使用了一个 定义与附加的 Sqrt[pi/2] 因子.)

用你的函数测试它,x ~= t -->a*(s/a) = 45.185, y ~= t^3/3 -->a*(s/a)^3/3 = 73.915445 * 0.6113066^3/3 = 5.628481(原文如此!/3 不是 /6,你有一个错误).

所以你看,到目前为止,仅使用菲涅耳积分的泰勒级数表示中的第一项是不够的.您必须使用更多,并且只有在达到所需精度时才停止(即,当最后一个计算项在幅度上小于您预设的精度值时).

请注意,如果您只是为一次性缩放回旋曲线计算实现一般的菲涅尔积分函数,那么当您将结果乘以 a(即通常为 102 ... 103,对于公路和铁路).

I'm coding renderer for road network, which based on the RoadXML format.

Road curves from this format has four types:

  • segment,
  • circle arc,
  • poly line,
  • clotho arc.

And I have problem with the last one.

Clothoid is the same with Euler spiral and Cornu spiral. In the RoadXML clotho arc is given by three parameters:

  • start curvature,
  • end curvature,
  • length.

For arc triangulation I need a function like foo(t), which returns (x, y) coords for t = 0..length. I created similar methods for circle arc without problems, but I can't do it for clotho arc.

Part of the problem is that I not totally understand how to apply start and end curvature parameters in standard clothoid formulas.

For example, sample RoadXML road. RoadXML sample http://img560.imageshack.us/img560/8172/bigroandabout.png

This is clotho curve item in the red ellipse. It's parameters:

  • start curvature = 0,
  • end curvature = -0.0165407,
  • length = 45.185.

I don't know how to implement these parameters, because clothoid curvature from 0 to -0.0165 is very straight.

I will happy, if you give me a code of this function (in C++, C#, Java, Python or pseudocode) or just a formula, which I can code.

Here is my equations:

x(t) ≈ t,
y(t) ≈ (t^3) / 6,
where length = t = s = curvature.

x(-0.0165) = -0.0165,
y(-0.0165) = -7.48688E-07.

Clotho length = 0.0165,
Source length = 45.185.

Scaled coords:

x'(l) = x / clotho_length * source_length = 45.185,
y'(l) = y / clotho_length * source_length = 5.58149E-07 ≈ 0.

x'(0) = 0,
y'(0) = 0.

Thus I get (0, 0)...(45, 0) points, which is very straight.

Where is my mistake? What am I doing wrong?

解决方案

Let's see. Your data is:

start curvature = 0,                straight line, R=INF
end curvature = -0.0165407,         circular arc, R_c = 1/k_c = 60.4569335
length = 45.185.                    distance along clothoid, s_c = 45.185

according to Wikipedia article,

R s = const = R_c s_c                   ( s ~ k = 1/R by definition of clothoid )
d(s) = R d(theta)
d(theta) = k d(s)
d(theta) / d(s) = 1 / R = k = s / R_c s_c  

theta = s^2 / 2 R_c s_c = (s/a)^2 = s / 2 R = k s / 2 
                               where ___________________
                                     a = sqrt(2 R_c s_c)       (... = 73.915445 )
                                     ~~~~~~~~~~~~~~~~~~~
    and so  theta_c = k_c s_c / 2      (... = 0.37369576475 = 21.411190 degrees )
                                                     ( not so flat after all !! )

(note: I call a here a reciprocal of what WP article calls a). Then,

d(x) = d(s) cos(theta)
d(y) = d(s) sin(theta)

x = INT[s=0..s] cos(theta) d(s) 
  = INT[s=0..s] cos((s/a)^2) a d(s/a) 
  = a INT[u=0..(s/a)] cos(u^2) d(u)   = a C( s/a )

y = a INT[u=0..(s/a)] sin(u^2) d(u)   = a S( s/a )

where C(t) and S(t) are Fresnel integrals.

So that's how you do the scaling. Not just t = s, but t = s/a = sqrt(theta). Here, for the end point, t_c = sqrt( k_c s_c / 2) = sqrt( 0.0165407 * 45.185 / 2) = 0.6113066.

Now, WolframAlpha says, {73.915445 Sqrt[pi/2] FresnelC[0.6113066/Sqrt[pi/2]], 73.915445 Sqrt[pi/2] FresnelS[0.6113066/Sqrt[pi/2]]} = {44.5581, 5.57259}. (Apparently Mathematica uses a definition scaled with the additional Sqrt[pi/2] factor.)

Testing it with your functions, x ~= t --> a*(s/a) = 45.185, y ~= t^3/3 --> a*(s/a)^3/3 = 73.915445 * 0.6113066^3 / 3 = 5.628481 (sic! /3 not /6, you have an error there).

So you see, using just the first term from the Taylor series representation of Fresnel integrals is not enough - by far. You have to use more, and stop only when desired precision is reached (i.e. when the last calculated term is less than your pre-set precision value in magnitude).

Note, that if you'll just implement general Fresnel integral functions for one-off scaled clothoid calculation, you'll lose additional precision when you'll multiply the results back by a (which is on the order of 102 ... 103 normally, for roads and railways).

这篇关于回旋曲线的参数化函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆