We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Ultimately I want to contain my particles within the boundaries of a custom shape. At the moment I would love some direction/resources to accomplish this, and/or even an example to help me learn how to simply contain the ball bounce example within a custom shape, such as a hexagon. Thank you.
Answers
There probably multiple ways to do it but I would make an object for each line of the shape then calculate the distance from the center of the particule to each line (https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line). If the distance is less than the radius of the particule then you have collision.
@slow_izzm -- if you are trying to do collision detection then the math depends on the shape. It sounds like you may be interested in eventually drawing arbitrary polygons. Here is an overview of collision detection with examples to get started, and the link to the point/polygon page. That page shows an example using an irregular shape and also walks through part of how it works with a regular octagon.
And I'd just use some existing libraries like Box2D.
thanks everyone, all these suggestions are exactly what I was in search of.