Skip to content

Commit ce0508b

Browse files
committed
Update aabb version
1 parent 2c8c01a commit ce0508b

File tree

3 files changed

+48
-23
lines changed

3 files changed

+48
-23
lines changed

Cargo.lock

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ readme = "README.md"
1616

1717
[dependencies]
1818
togo = "0.6"
19-
aabb = "0.5"
19+
aabb = "0.6"
2020
robust = "1.2"
2121

2222
[lib]
Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1+
use offroad::prelude::*;
12
use std::time::Instant;
23
use togo::{poly::arcline200, prelude::*};
3-
use offroad::prelude::*;
44

55
fn main() {
66
println!("Multi-Offset Benchmark (~200 arcs in double spiral)");
77
println!("======================================================");
8-
8+
99
let mut cfg = OffsetCfg::default();
1010
cfg.svg_orig = false;
1111
let arc_orig = arcline200();
12-
12+
1313
let start = Instant::now();
14-
15-
// Forward direction
16-
for i in 1..100 {
17-
offset_arcline_to_arcline(&arc_orig, (i as f64)/4.0, &mut cfg);
18-
}
19-
20-
// Reverse direction
21-
let arcs_reversed = arcline_reverse(&arc_orig);
22-
for i in 1..100 {
23-
offset_arcline_to_arcline(&arcs_reversed, (i as f64)/4.0, &mut cfg);
14+
15+
for _ in 0..10 {
16+
// Forward direction
17+
for i in 1..100 {
18+
offset_arcline_to_arcline(&arc_orig, (i as f64) / 4.0, &mut cfg);
19+
}
20+
21+
// Reverse direction
22+
let arcs_reversed = arcline_reverse(&arc_orig);
23+
for i in 1..100 {
24+
offset_arcline_to_arcline(&arcs_reversed, (i as f64) / 4.0, &mut cfg);
25+
}
2426
}
25-
27+
2628
let total_time = start.elapsed();
27-
let operations = 99 * 2; // 99 offsets in each direction
29+
let operations = 10 * 99 * 2; // 99 offsets in each direction
2830
let avg_per_operation = total_time / operations;
29-
30-
println!("Total time for {} offset operations: {:?}", operations, total_time);
31+
32+
println!(
33+
"Total time for {} offset operations: {:?}",
34+
operations, total_time
35+
);
3136
println!("Average time per operation: {:?}", avg_per_operation);
32-
println!("Operations per second: {:.1}", 1.0 / avg_per_operation.as_secs_f64());
37+
println!(
38+
"Operations per second: {:.1}",
39+
1.0 / avg_per_operation.as_secs_f64()
40+
);
3341
}
3442

3543
/*
@@ -55,4 +63,15 @@ Total time for 198 offset operations: 1.207932511s
5563
Average time per operation: 6.100669ms
5664
Operations per second: 163.9
5765
66+
The calculation is now repeated 10 times.
67+
68+
AABB v0.5:
69+
Total time for 1980 offset operations: 12.071528916s
70+
Average time per operation: 6.096731ms
71+
Operations per second: 164.0
72+
73+
74+
75+
76+
5877
*/

0 commit comments

Comments
 (0)