Move 2D benchmarks into their own directory/crate.

This commit is contained in:
Crozet Sébastien
2020-09-28 10:19:49 +02:00
parent 0829ed10ac
commit e7466e2f69
16 changed files with 256 additions and 30 deletions

View File

@@ -19,7 +19,7 @@ pub fn init_world(testbed: &mut Testbed) {
let heights = DVector::from_fn(nsubdivs + 1, |i, _| {
if i == 0 || i == nsubdivs {
80.0
8.0
} else {
(i as f32 * ground_size.x / (nsubdivs as f32)).cos() * 2.0
}
@@ -33,7 +33,7 @@ pub fn init_world(testbed: &mut Testbed) {
/*
* Create the cubes
*/
let num = 26;
let num = 20;
let rad = 0.5;
let shift = rad * 2.0;
@@ -41,7 +41,7 @@ pub fn init_world(testbed: &mut Testbed) {
let centery = shift / 2.0;
for i in 0..num {
for j in 0usize..num * 5 {
for j in 0usize..num {
let x = i as f32 * shift - centerx;
let y = j as f32 * shift + centery + 3.0;
@@ -63,7 +63,7 @@ pub fn init_world(testbed: &mut Testbed) {
* Set up the testbed.
*/
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point2::new(0.0, 50.0), 10.0);
testbed.look_at(Point2::new(0.0, 0.0), 10.0);
}
fn main() {