File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ codegen-units = 1
2727panic = " abort"
2828opt-level = 3
2929# for samply
30- # debug = 1
30+ debug = 1
3131
3232
3333[dev-dependencies ]
Original file line number Diff line number Diff line change 1+ use rand:: { Rng , SeedableRng , rngs:: StdRng } ;
2+ use togo:: prelude:: * ;
3+
4+ /// Configurable number of points
5+ const N_POINTS : usize = 10000 ;
6+
7+ fn main ( ) {
8+ // Use fixed seed for reproducible results
9+ let mut rng = StdRng :: seed_from_u64 ( 42 ) ;
10+
11+ // Generate random points once with fixed seed
12+ let points: Pointline = ( 0 ..N_POINTS )
13+ . map ( |_| point (
14+ rng. random :: < f64 > ( ) * 10000.0 ,
15+ rng. random :: < f64 > ( ) * 10000.0 ,
16+ ) )
17+ . collect ( ) ;
18+
19+ // Compute convex hull
20+ let mut hull = Vec :: new ( ) ;
21+ for _ in 0 ..500 {
22+ hull = pointline_convex_hull ( & points) ;
23+ }
24+
25+ // Use the result to prevent optimization
26+ println ! ( "Hull size: {}" , hull. len( ) ) ;
27+ }
28+ /*
29+ samply record cargo run --release --example convex_hull
30+
31+ */
You can’t perform that action at this time.
0 commit comments