Ball Collision Simulation

This is a simple physics engine for simulating sphere collision.
1,2K descargas
Actualizado 16 ene 2015

Ver licencia

This matlab function simply simulates the collision of balls. Each ball has three properties: radius, mass and charge quantity. The program detects possible collisions in each frame.
Examples:
>>SphereCollider([1.25 1 0;1.25 1 0],[-5 0 0;1.25 0 0],[3 0 0;0 0 0],...
'g',0,'debug','off','t',25)
>>SphereCollider('g',0,'debug','off')
>>SphereCollider([1 1 0],[0 0 0],[0 0 0],...
'GravityVec',[0 -1 0],'GroundPoint',[0 -10 0],...
'g',1,'dt',0.025,'debug','on','t',20)
>>SphereCollider([0.5 1 0],[-5 0 0],[0 1.15 0],...
'sphere',[2 0 0 0],'GravitySrc',[10 0 0 0],...
'G',-1,'g',0,'debug','off','t',300)
The movement of walls is defined by anonymous functions of time. The corresponding input argument is a cell that contains handles of such functions,
{...
{@(t) vx, @(t) vy, @(t) vz},... velocity of the first wall
{@(t) vx, @(t) vy, @(t) vz},... velocity of the second wall
...
}
For example:
f1 = @(t) 0.2*heaviside(t)-0.2*heaviside(t-20);
f2 = @(t) 0;
v = {{f1,f2,f2}};
SphereCollider([1 1 0;1 1 0;1 1 0],[0 4 0;0 -4 0;-4 0 0],[2 -2 0;1 1 0;2 4 0],'sphere',[2 0 0 0],'g',0,'debug','off','t',250,'sphere_velocity',v)

Citar como

Ligong Han (2024). Ball Collision Simulation (https://www.mathworks.com/matlabcentral/fileexchange/41032-ball-collision-simulation), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2012a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Physics en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.4.0.0

- problems with parameter assignment fixed
- new demos added
- I include IdealGasSimulation.m in this submittion

1.3.0.0

- new feature added, walls can move now
- added demos

1.2.0.0

minor bug fixes

1.0.0.0