code: static boolean pointInPolygon(float[] pt, float[] verts, int nverts) {
          // TODO: Replace pnpoly with triArea2D tests?
          int i, j;
          boolean c = false;
          for (i = 0, j = nverts - 1; i < nverts; j = i++) {
              int vi = i * 3;
              int vj = j * 3;
              if (((verts[vi + 2] > pt[2]) != (verts[vj + 2] > pt[2])) && (pt[0] < (verts[vj + 0] - verts[vi + 0])
                      * (pt[2] - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) {
                  c = !c;
              }
          }
          return c;
      }
docs: / All points are projected onto the xz-plane, so the y-values are ignored.