alexbol99 / flatten-js

Javascript library for 2d geometry
MIT License
560 stars 58 forks source link

intersect for box and line or segment doesn't exist #30

Closed stocksp closed 4 years ago

stocksp commented 5 years ago

Box isn't a shape inside the intersect method for either segment or line. So passing a box to their intersect method fails.

I didn't see anywhere the intersectLine2Box(line, box) function was exported. Though its used internally.

I took the three function: intersectLine2Box, intersectSegment2Line and intersectLine2Line: They work for what I'm doing..

Great library! thanks for all your work!

alexbol99 commented 4 years ago

Support intersection with box added in v1.0.19. Now method intersect(shape) supports shape of type Box for Line, Segment, Arc and Circle. Method return array of intersection points. Intersection between Polygon and Box will be added later.