Determine if a point (x, y, z) is inside the shape defined by an array of points

If I have an array of points (x, y, z) and one point (x, y, z) is specified, what code do I use to determine if this point is inside the form defined by the array?

I draw a space on this ...

I am using c #

EDIT

Thanks for the guys answers, from the comments I found this link ( http://alienryderflex.com/polygon/ ), which explains this process quite well.

Thank!

FYI:

bool pointInPolygon() {

      int      i, j=polySides-1 ;
      boolean  oddNodes=NO      ;

      for (i=0; i<polySides; i++) {
        if (polyY[i]<y && polyY[j]>=y
        ||  polyY[j]<y && polyY[i]>=y) {
          if (polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x) {
            oddNodes=!oddNodes; }}
        j=i; }

      return oddNodes; }

It will require some work, but it is his gut.

Thanks again

+5
source share
2 answers

, , , , . , .

+16

, , , , . : . ( , , , ; WPF Media3D , ), , . 2D- > 0 " ", 2D- " ", .

.

+2

All Articles