I am creating a simulation where little, fast moving, particles need to intersect with the edges of the iPhone X screen.
Previously I have had no difficulty with my collisions. The particles have traditionally been within a rectangular screen and thus when the time comes it is a simple AABB to line collision resolution. Even though the particles are technically moving as rounded rectangles/capsules since they have width I can simply add the appropriate amount to the position for each surface I want to determine the intersection with.
The iPhone X is not that easy at all. It has a complicated shape that I cant match with primitives. Here is my attempt:
You can see how there are a few issues. The most glaring of which is the concave corner on either side of the faceID housing. You can see I approximate that whole thing with two rectangles and two circles. (The smaller rectangle isnt very visible but it is thin and connects the circle to the outer boundary.
There is also a wedge of space on the rounded corners of the phone.
I have yet to figure out how to calculate the collision of my particles with these shapes so I dont know for sure but I am guessing that given the inaccuracies that it wont look that great and the normals will be tricky to get right in situations like where one side of the particle is touching the faceID area and another is touching the outer rectangle.
Probably bezier curves would be a good bet here however I am betting they are too expensive and dont work well with line intersection detection.
Do you have any suggestions about how I might properly determine and resolve these collisions with the odd iPhone X shape?
Keep in mind I am trying to simulate thousands of particles and they are rather small and I dont have much more CPU time left to calculate this collision.
Any advice or other ways you can think of for me to do these collisions would be greatly appreciated. Would really love to have some insight on how I can get the rounded corners and the sides of the faceID housing to not have slivers.

