This commit is contained in:
Timothy Warren 2020-01-13 11:25:46 -05:00
parent 8c08349b04
commit b4113effa7

View File

@ -95,8 +95,7 @@ static mut solar_Bodies: [body; BODIES_COUNT] = [
fn offset_Momentum(bodies: &mut [body; BODIES_COUNT]) { fn offset_Momentum(bodies: &mut [body; BODIES_COUNT]) {
for i in 0..BODIES_COUNT { for i in 0..BODIES_COUNT {
for m in 0..3 { for m in 0..3 {
bodies[0].velocity[m] -= bodies[0].velocity[m] -= bodies[i].velocity[m] * bodies[i].mass / SOLAR_MASS;
bodies[i].velocity[m] * bodies[i].mass / SOLAR_MASS;
} }
} }
} }
@ -175,8 +174,7 @@ unsafe fn advance(bodies: &mut [body; BODIES_COUNT]) {
for i in 0..BODIES_COUNT - 1 { for i in 0..BODIES_COUNT - 1 {
for j in i + 1..BODIES_COUNT { for j in i + 1..BODIES_COUNT {
for m in 0..3 { for m in 0..3 {
position_Deltas[m].0[k] = position_Deltas[m].0[k] = bodies[i].position[m] - bodies[j].position[m];
bodies[i].position[m] - bodies[j].position[m];
} }
k += 1; k += 1;
} }