Effacer les filtres
Effacer les filtres

How do I tell if a point is in or on a boundary set by equations

13 vues (au cours des 30 derniers jours)
Andrew Padilla
Andrew Padilla le 1 Nov 2018
Commenté : Star Strider le 1 Nov 2018
I have a power curve, horizontal line, vertical line, and a linear line. The four of these enclose a region on a plot. I am looking to see if a user-inputted point is within or on the boundary. If anyone could guide me into the right direction, I would appreciate it.

Réponse acceptée

Star Strider
Star Strider le 1 Nov 2018
The inpolygon (link) function could be helpful.
  4 commentaires
Andrew Padilla
Andrew Padilla le 1 Nov 2018
Strider,
I figured out a solution. It turns out, inpolygon() can be used to help out. Because the other equations are linear, in_polygon() will work for those boundaries. It fails where the shape is bounded by the power curve. Because of this, I have to check that the y value is greater than the x of the y value plugged in to the power curve equation. With that said, I created a conditional statement that checked if the y value was greater AND in or on is equal to one. If both of these are true, the point is in the shape. I will accept this as an answer because it did guide me to getting the answer.
Star Strider
Star Strider le 1 Nov 2018
Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by