Point-in-polygon
✓ Published0🌍 Public
JJustinGOSSES
Last edited May 11, 2018
Created on May 11, 2018
This example demonstrates the point-in-polygon algorithm by letting users draw a polygon directly on an SVG canvas while 1000 randomly placed dots update in real time. Dots that fall inside the drawn shape turn red, while those outside remain steel blue. The implementation uses D3 v3’s `d3.behavior.drag` to capture mouse coordinates and a ray-casting algorithm to test each point against the polygon’s vertices. A clear link resets the visualization by removing the drawn path and deselecting all dots.
AI-generated descriptionforked from <a href='http://bl.ocks.org/cool-Blue/'>cool-Blue</a>'s block: <a href='http://bl.ocks.org/cool-Blue/dddd322623c8be46edd8'>Point-in-polygon</a>
mit Licensed