필터 지우기
필터 지우기

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

조회 수: 12 (최근 30일)
Andrew Padilla
Andrew Padilla 2018년 11월 1일
댓글: Star Strider 2018년 11월 1일
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.

채택된 답변

Star Strider
Star Strider 2018년 11월 1일
The inpolygon (link) function could be helpful.
  댓글 수: 4
Andrew Padilla
Andrew Padilla 2018년 11월 1일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by