Fix n-body visualization

This commit is contained in:
dcodeIO
2018-07-22 02:55:46 +02:00
parent 813d2e33c8
commit a1e2071da6
15 changed files with 134 additions and 43 deletions

View File

@ -203,3 +203,8 @@ export function step(): float {
export function bench(steps: u32): void {
for (let i: u32 = 0; i < steps; ++i) system.advance(0.01);
}
export function getBody(index: i32): Body | null {
var bodies = system.bodies;
return <u32>index < <u32>bodies.length ? bodies[index] : null;
}