Skip to content

Commit

Permalink
Update point-in-polygon.js
Browse files Browse the repository at this point in the history
A fix for d3 issue d3#2025 not sure if it is fully backwards compatible, but the basic premises is that a point cannot be in a 0 area polygon. Putting the if statement there doesn't seem to impact performance, but I haven't done any serious benchmarking.
  • Loading branch information
stvno committed Sep 18, 2014
1 parent a10b226 commit 9b735ac
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/geo/point-in-polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "../math/abs";
import "../math/trigonometry";

function d3_geo_pointInPolygon(point, polygon) {
if(d3.geo.area(polygon) ==0 ) return false; //a point cannot be in a zero sized polygon
var meridian = point[0],
parallel = point[1],
meridianNormal = [Math.sin(meridian), -Math.cos(meridian), 0],
Expand Down

0 comments on commit 9b735ac

Please sign in to comment.