Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: deviation estimation #152

Open
kimstik opened this issue Jul 28, 2022 · 2 comments
Open

Question: deviation estimation #152

kimstik opened this issue Jul 28, 2022 · 2 comments
Labels
bug There is a problem with the coding or algorithms

Comments

@kimstik
Copy link

kimstik commented Jul 28, 2022

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

@kimstik kimstik added the bug There is a problem with the coding or algorithms label Jul 28, 2022
@carlos-adir
Copy link

carlos-adir commented Jul 28, 2022

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
Copy link

portnov commented Jul 28, 2022

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

  • for each segment of your piecewise line, cut a corresponding segment from interpolated curve — i.e. find control points of the curve which is identical to your interpolation curve, but starts and ends at the end points of linear segment (there are methods for this in geomdl).
  • now, you have a set of pairs: a linear segment and corresponding piece of the curve. Now you can apply the property of nurbs curves known as "strong convex hull property": all points of the curve lie inside the convex hull built on it's control points. So, if you calculate the distance from each control point of curve's segment to linear segment (there are obvious enough formulas), and find the maximum of such distances, you will know that your curve segment derives from linear segment not more than for this maximum.
  • then you just find the maximum of such maximum distances across all segments.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug There is a problem with the coding or algorithms
Projects
None yet
Development

No branches or pull requests

3 participants