任何旋转中两个抛物线相交的代码或公式 [英] Code or formula for intersection of two parabolas in any rotation

查看:136
本文介绍了任何旋转中两个抛物线相交的代码或公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究几何问题,需要在任何旋转中找到两个抛物线弧的交点。通过旋转平面使弧线与轴线对齐,我能够将线条和抛物线弧线进行合并,但是两个抛物线不能与轴线对齐。我正在致力于推导公式,但我想知道是否有可用于此的资源。

解决方案

I首先定义无旋转的2D抛物线弧的方程:

  x(t)=ax²+ bx + c $ (t)= t; 

您现在可以通过构建旋转矩阵来应用旋转:

  s = sin(角度)
c = cos(角度)

矩阵= | c -s |
| s c |

应用该矩阵,您将得到旋转的参数方程:

  x'(t)= x(t)* c  -  s * t; 
y'(t)= x(t)* s + c * t;

这将为您提供抛物线弧的两个方程(对于x和y)。



为两个旋转的弧线做相同的操作并减去它们。这给你一个这样的等式:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ (t)= y中的arc1的旋转方程。
xb'(t)=旋转后的方程arc2在x
中yb'(t)=旋转后的方程arc2的y。
t1 = arc1的参数值
t2 = arc2的参数值

0 = xa'(t1) - xb'(t2)
0 = ya'( t1) - yb'(t2)

这些方程中的每一个都只是一个2阶多项式。这些很容易解决。



要找到交点,您可以解出上述等式(例如找到根)。

你会得到每个轴的两个根。任何在x和y上相等的根都是曲线之间的交点。



现在获取位置很简单:只需将根插入参数方程中,即可直接得到x和y。


I am working on a geometry problem that requires finding the intersection of two parabolic arcs in any rotation. I was able to intesect a line and a parabolic arc by rotating the plane to align the arc with an axis, but two parabolas cannot both align with an axis. I am working on deriving the formulas, but I would like to know if there is a resource already available for this.

解决方案

I'd first define the equation for the parabolic arc in 2D without rotations:

  x(t) = ax² + bx + c
  y(t) = t;

You can now apply the rotation by building a rotation matrix:

  s = sin(angle)
  c = cos(angle)

  matrix = | c -s |
           | s  c |

Apply that matrix and you'll get the rotated parametric equation:

x' (t) = x(t) * c - s*t;
y' (t) = x(t) * s + c*t;

This will give you two equations (for x and y) of your parabolic arcs.

Do that for both of your rotated arcs and subtract them. This gives you an equation like this:

  xa'(t) = rotated equation of arc1 in x
  ya'(t) = rotated equation of arc1 in y.
  xb'(t) = rotated equation of arc2 in x
  yb'(t) = rotated equation of arc2 in y.
  t1 = parametric value of arc1
  t2 = parametric value of arc2

  0 = xa'(t1) - xb'(t2)
  0 = ya'(t1) - yb'(t2)

Each of these equation is just a order 2 polynomial. These are easy to solve.

To find the intersection points you solve the above equation (e.g. find the roots).

You'll get up to two roots for each axis. Any root that is equal on x and y is an intersection point between the curves.

Getting the position is easy now: Just plug the root into your parametric equation and you can directly get x and y.

这篇关于任何旋转中两个抛物线相交的代码或公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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