Find if a point lies bellow or above a curve
Afficher commentaires plus anciens
Is it possible to find if a point lies under a curve C if the curve is not defined by an equation but by points? Say we have point Po(Xo,Yo) and I want to find if this Po is located below, under or on the curve.
Any ideas of how to do that?
I can only think of the following method:
- Drawing a line 'l' connecting (0,0),Po, the curve
- Finding the coordinates of the point P1 at which 'l' crosses the curve.
- Measuring the distance from (0,0) to Po = d1 and comparing it with the distance from (0,0) to P1 =d2
- If the d1>d2, Po is above, else, it is below
The problems:
- I don't know how to make the line go through the curve
- I don't know how to find the coordinates of the point at which the line crosses the curve
I know this might be a simple question for most of you but mathematically I can only think of formulas related to polygons, circles, triangles...etc. not for assymptotic curve.
Thank you!
Lina
1 commentaire
If your curve C is convex (or concave), then you can find this easily by solving a linear system to find the linear combination of curve-points that give your query-point (regularised in the least-squared sense). Otherwise, if your curve doesn't have too many points, you can simply check whether your query-point is under/over each line-segment that makes up your curve (consecutive pairs of curve-points).
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
