简体   繁体   English

寻找一组点的拐点

[英]Finding inflection points of a set of points

I am working on something that can fit a set of Bezier curves through a set of points.我正在研究可以通过一组点拟合一组贝塞尔曲线的东西。 I've been able to do this using the curve fitting method from Pomax .我已经能够使用Pomax的曲线拟合方法来做到这一点。 The problem with this method is that it cannot fit a low order Bezier curve through a line that has many inflections.这种方法的问题在于它不能通过具有许多拐点的线拟合低阶贝塞尔曲线。 Therefore in order to make this work, I need to be able to get a piecewise cubic-bezier by splitting the curve at its inflection points and then running the curve fitting algo from there.因此,为了完成这项工作,我需要能够通过在拐点处分割曲线然后从那里运行曲线拟合算法来获得分段三次贝塞尔曲线。 The problem is that I'm not sure how to find the derivative of a set of points that have no clear function.问题是我不确定如何找到一组没有明确功能的点的导数。 I guess I could always calculate the slope of the secant line instead of the tangent line, but I'm not sure if that would work well.我想我总是可以计算割线的斜率而不是切线,但我不确定这是否有效。 Does anybody have any better ideas on how to find the inflection points of a set of points?有人对如何找到一组点的拐点有更好的想法吗?

Inflex point is dividing curve where the curvature winding goes from CW to CCW or vice versa.拐点是曲率缠绕从 CW 到 CCW 的分界曲线,反之亦然。 So first detect the winding.所以首先要检测绕组。

Assuming 2D case...假设 2D 情况...

If your points are { p0,p1,p2,...,p(n-1) } then winding at p(i) is the sign of z coordinate of 3D cross product of 2 consequent tangents:如果您的点是{ p0,p1,p2,...,p(n-1) }那么在p(i)处的绕组是 2 个相应切线的 3D cross积的z坐标的sign

w(i)  = cross (
              ( p(i).x-p(i-1).x , p(i).y-p(i-1).y , 0)
              ( p(i+1).x-p(i).x , p(i+1).y-p(i).y , 0)
              ).z

So if p(i) is inflex then:所以如果p(i)是 inflex 那么:

w(i)*w(i-1) < 0

The problem is if w(i) or w(i-1) is zero such winding must be skipped or specially handled.问题是如果w(i)w(i-1)为零,则必须跳过或特殊处理此类绕组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM