I am currently interested in billiards and their trajectories. I would like to simulate a billiard inside a water tight mesh. A mesh basically consists of a list of points in 3D space (vectors with 3 entries) together with a list of 3 vectors of natural numbers, which specify the corner points of each triangle. Now I would like to have a reflection whenever the trajectory of the ball crosses the triangle. [![enter image description here][1]][1] I would already be happy about pseudocode [1]: https://i.sstatic.net/0F0H0.png So, technically the question is, how can I find a let the trajectory now it is crossing the triangle and it should perform a reflection. Remark: I would later like to play billiards of charged balls in magnetic fields. I can therefore not assume that the balls follow a straight line. Any ideas?