mapbox / tile-cover

Generate the minimum number of tiles to cover a geojson geometry
MIT License
189 stars 40 forks source link

Replace lineIntersects with proper vertical/horizontal intersection calculation #48

Closed mourner closed 9 years ago

mourner commented 9 years ago

Current lineIntersects function calculates intersections of arbitrary lines, but we have a much simpler use case. We only need 2 algorithms — one for vertical line intersection and another one for horizontal one, which are trivial, and will allow us to handle trivial rejects (where a segment doesn't intersect) incredibly fast.