How to model particle bouncing off of a curved surface in 3D?

时间:2015-06-25 18:49:21

标签: python 3d geometry computational-geometry

I am trying to simulate a particle bouncing off the sides of a cylinder (inside) or any closed curved surface in 3 dimensions. At the moment of interaction with the surface, I have the position vector, the velocity vector, and the plane tangent to the surface at the intersection, and I am looking to derive the new velocity vector. Currently coding in Python, but pseudocode/general algorithm would be immensely helpful as well.

2 个答案:

答案 0 :(得分:0)

Get the normal vector of the plane. (you can make a cross product between two non parallel vectors in the plane for that). Take the velocity vector components relative to the normal vector and: Make parallel component negative Keep perpendicular components the same. Following an approach similar to @jacdeh: Normalize the normal vector Make the inner product of velocity with unit normal (that is the scalar speed against the surface) Multiply the inner product with unit normal (that is the parallel component I mentioned). Subtract 2 times that component from velocity and this is the result.

答案 1 :(得分:0)

Compute normal vector as cross product of two tangent vectors to your surface Normalize it to get unit normal Compute inner product (dot product) of minus velocity and normal vector Multiply inner product with unit normal to get projection on normal Subtract projection on normal from minus velocity Add that to projection to get new speed vector