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:

enter image description here

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.

enter image description here

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.

  • $\begingroup$ I have no idea what i am writing here . But can't you stimulate the notch as a stack of rectangles (of very small width) stacked on top of one another? $\endgroup$
    – Awakened
    Sep 24 '18 at 14:41
  • 1
    $\begingroup$ Sort of yes. The only two problems with that would be that particles couldn’t slide across the edge and there would be naccurate normals $\endgroup$
    – J.Doe
    Sep 24 '18 at 14:42
  • $\begingroup$ Are you trying to create a live wallpaper or something? I think math.SE is not the correct site for this question. still , love your question. $\endgroup$
    – Awakened
    Sep 24 '18 at 14:49
  • 2
    $\begingroup$ I am mosty asking Math SE to get some insights from people that may know more ways to define geometry/shapes in a way that is easy to calculate an intersection of a line with $\endgroup$
    – J.Doe
    Sep 24 '18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.