Clear Filters
Clear Filters

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

12 views (last 30 days)
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.

Accepted Answer

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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!