Check point within polygon

后端 未结 2 1500
情歌与酒
情歌与酒 2021-02-09 05:24
int pnpoly(int npol, float *xp, float *yp, float x, float y)
{
   int i, j, c = 0;
   for (i = 0, j = npol-1; i < npol; j = i++) {
     if ((((yp[i] <= y) &&am         


        
2条回答
  •  -上瘾入骨i
    2021-02-09 05:40

    Note that if your polygon N and N+1 have the same y value then this test can fail computing vt. For example: determining if a point is inside an axis aligned square.

    You need to deal with lines parallel on y

提交回复
热议问题