alexbol99 / flatten-js

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

Intersect between two circles missing #41

Closed JonaCodes closed 4 years ago

JonaCodes commented 4 years ago

Currently, when using the Relations.intersect function, an error is thrown when both params are Circle because the the relate function doesn't have a relateCircle2Circle

Would be useful when you need to find whether two circles intersect, without using Circle's intersect method and testing for a non-empty array.

alexbol99 commented 4 years ago

Hello @JonaCodes ,

Now Relations.intersect consider Circle and Box, the fix available in the patch v1.2.5.

Note the difference between methods Circle.intersect() and Relations.intersect(). The first one returns intersection points between boundaries of two shapes. The second one checks if shapes are topologically intersected: if there exist at least one common point between either boundaries or interiors of two shapes. It means that Relation.intersect returns true in case of one circle inside another. Check what kind of relationships you exactly need. You can play with this notebook and see how you can detect other types of relationships like inside, disjoint, touch or cover.

Best, Alex Bol

JonaCodes commented 4 years ago

thanks!