when i use inpolygon function the result is wrong but i don't konw why

8 views (last 30 days)
[in on] = inpolygon(x,y,vx,vy); this is the commond I used in my code. vx and vy is the x and y corrdinate of boundary vertices and plot these points .
the bule point is the boundary.
x and y is a 2d matrix and they are the x and y corrdinate of points that are needed to check if in polygon. but the answer is wrong. the answer is below:
the right answer is that points in polygon all should be choosen. But I have not find something wrong in data or code? anybody can give me some advices? thank you very much
  1 Comment
Jos (10584)
Jos (10584) on 12 Jun 2015
Are your xv and yv points in the correct order? You can simply check by adding a connected line to the plot:
plot(xv,yv,'b+-')

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!