Azzera filtri
Azzera filtri

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

13 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Star Strider
Star Strider il 1 Nov 2018
The inpolygon (link) function could be helpful.
  4 Commenti
Andrew Padilla
Andrew Padilla il 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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by