is this point-inside-polygon function similar to https://gist.github.com/zz85/1258163 ?