🏠 back to Observable

Collision Detection Within Shapefile Boundaries


I’d like to make a dot density map with collision detection. I’d also like the marks to be contained within geographical boundaries - however I’m not sure if this is possible.

Could anybody point me in the right direction for how this could be achieved?

Many thanks,

You’ve probably already discovered that there are several JS physics engines which can handle concave polygons (e.g. matter.js).

Perhaps you can share more details about your notebook (ideally even a link to your draft), like:

  • Do you only want to detect shape intersections, or do you need to resolve collision constraints?
  • Where / when should collision happen?
  • What kind of interactions are you planning?
  • What are your current road blocks?