by Andrew Kickertz
Collision detection via meshes, and rough calculation of post-impact velocities.
Over the past couple weeks I’ve been developing a method to detect collisions between pins, modeling them as meshes. I’m also thinking about describing the pins as parametric surfaces, but that’s another can of worms. The radius of the pin is defined at 15 heights as specified by the USBC:
These radii, heights, and the number of desired lines of longitude are fed into a custom cylinder-mesh-generation function:
function [x y z] = mycylinder(r,zIn,nLong) for i=1:length(r) for j=0:nLong x(i,j+1) = r(i)*cos(2*pi*j/nLong); y(i,j+1) = r(i)*sin(2*pi*j/nLong); z(i,j+1) = zIn(i); end end
For example, here is a pin mesh composed of the 15 prescribed radii and heights and 25 lines of longitude:
- PinMesh-eps-converted-to
- Rainbow colored pin mesh with 15 radii and heights, and 25 lines of longitude.
Collision is deemed to have occurred if the distance between any node on 1 pin is sufficiently close to any node on another pin:
distance(i,j) = dx^2 + dy^2 + dz^2;
Here is an example of collision detection for 2 roughly-meshed pins:
Computing the post-impact velocities is rather complicated for general bodies. The dynamics in this example aren’t quite right yet, but it looks believable: