raycast
v1.0.8
Published
Raycast algorithm helps you determine if a point lies inside a polygon
Downloads
70
Readme
Raycast
Raycast algorithm helps you determine if a point lies inside a polygon. Edge cases involved in working with LatLngs have been handled. The package also provides LatLng and Point classes to support following two methods
isLatLntInside([LatLng], LatLng);
isPointInside([Point], Point);
Example usage
var latlngs = [];
latlngs.push(new LatLng(28.635789, 77.215029));
latlngs.push(new LatLng(28.638086, 77.220952));
latlngs.push(new LatLng(28.634621, 77.225758));
latlngs.push(new LatLng(28.634771, 77.221467));
latlngs.push(new LatLng(28.632662, 77.225114));
latlngs.push(new LatLng(28.629724, 77.220265));
latlngs.push(new LatLng(28.631796, 77.215265));
var latlng = new LatLng(28.632869, 77.219466);
var isLatLngInside = raycast.isLatLngInside(latlngs, latlng);
See this blogpost for further explanation GitHub