Changes

Jump to: navigation, search

Unique Project Page

417 bytes added, 13:31, 24 February 2017
Profiling Data and Screenshots
}
} //We should really expand the loop for efficiency
}  void calculate_a(){ for (int j1=0;j1<ncobjects;j1++){ cobjects[j1]->a=vect(0,0,0); } for (int j1=0; j1<ncobjects;j1++){ for (int j2=j1+1;j2<ncobjects;j2++){ double m1=cobjects[j1]->m; double m2=cobjects[j2]->m; vect dist=cobjects[j1]->pos-cobjects[j2]->pos; double magd=dist.mag(); vect base=dist*(1.0/(magd*magd*magd)); cobjects[j1]->a+=base*(-m2); cobjects[j2]->a+=base*m1; } }}</syntaxhighlight>
|}
49
edits

Navigation menu