New answers tagged physics-engine
1
O(N^2) refers to the fact that if you have N objects, figuring out what is colliding with what is, worst case, N^2 collision computations. Say you have 3 objects. To find "who is hitting who", you have to find:
o1 hitting o2? o1 hitting o3?
o2 hitting o1? o2 hitting o3?
o3 hitting o1? o3 hitting o2?
That's 6 checks for collisions, or N*(N-1) checks. ...
8
Spatial division is always O(N^2) in worst case and that is what complexity in informatics is about.
However there are algorithms that work in linear time O(N). All of them are based on some kind of sweep line.
Basically you need to have your objects sorted by one coordinate. Let's say X. If you perform the sort every time before collision detection, the ...
9
No. Collision detection is not always O(N^2).
For instance, say we have a 100x100 space with objects with size 10x10. We could divide this space in cells of 10x10 with a grid.
Each object can be in up to 4 grid cells (it could fit right in a block or be "between" cells). We could keep a list of objects in each cell.
We only need to check for collisions in ...
0
Here's a trick to simplify things, based on the fact that all slots are the same size and shape:
Run a physics simulation with random input parameters but instead of rendering it just store the ball position and wheel rotation for each frame so you can replay it later.
Work out which slot the ball has landed in.
Calculate the angle between that slot and ...
Top 50 recent answers are included
