orbingol / NURBS-Python

Object-oriented pure Python B-Spline and NURBS library
https://onurraufbingol.com/NURBS-Python/
MIT License
603 stars 153 forks source link

Question: deviation estimation #152

Open kimstik opened 1 year ago

kimstik commented 1 year ago

What is recipe to numerically estimate the maximum deviation of the extrapolated curve from the original piecewise linear one? image

carlos-adir commented 1 year ago

I don't think there's already an algorithm that do it. So, I would do it by myself: 1) Find a region where you know the deviation is. Like, at u between two scalars ui and uj. 2) Get the tangent vector from the linear piecewise, the D vector. 3) Get the tangent vector V(u) from the extrapoled curve. 4) Your point at extrapoled curve is the one such V(u) = D. You can search it by binary search 5) Once gotten the u, compute the minimal distance of P(u) (extrapoled) from the linear one. It's what you need.

portnov commented 1 year ago

I can suggest a method which allows you to estimate this deviation, not exactly, but it can be enough:

Nurbs maths will guarantee that the curve never derives from your piecewise linear line more than for the value you find that way, but the deviation obviously can be less than it.