thelonious / kld-intersections

A library of intersection algorithms covering all SVG shape types
BSD 3-Clause "New" or "Revised" License
343 stars 55 forks source link

Add convenience layer for IntersectionQuery #20

Open thelonious opened 6 years ago

thelonious commented 6 years ago

Right now, you can use the intersection API 3 ways:

  1. Direct call to intersection method passing in essentially scalar values
  2. Via the Shapes API which still uses scalar values, but it creates intermediate objects for each support shape. These are then used by a single method in the intersection API to determine which low-level method to call
  3. Via the Affine Shapes API which is just like the Shapes API, but it lets you use Point2D, Vector2D, etc. in place of scalar values. This is for people who don't mind using those classes.

IntersectionQuery has been introduced recently and right now it has the equivalent of the intersection api's low-level interface. Using either of the Shapes API, we should be able to introduce a simple IntersectionQuery.contains(point, shape) method.

brettz9 commented 5 years ago

A contains method (if not containsOrIntersects) sounds very useful!