MCPcopy Create free account
hub / github.com/ecto/muni / l_shaped_polygon

Function l_shaped_polygon

depot/dispatch/src/coverage.rs:302–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300
301 #[test]
302 fn l_shaped_polygon() {
303 // L-shape: non-convex polygon
304 let polygon = vec![
305 Waypoint { x: 0.0, y: 0.0, theta: None },
306 Waypoint { x: 4.0, y: 0.0, theta: None },
307 Waypoint { x: 4.0, y: 2.0, theta: None },
308 Waypoint { x: 2.0, y: 2.0, theta: None },
309 Waypoint { x: 2.0, y: 4.0, theta: None },
310 Waypoint { x: 0.0, y: 4.0, theta: None },
311 ];
312 let config = CoverageConfig {
313 tool_width: 1.0,
314 overlap_pct: 0.0,
315 swath_angle: Some(0.0),
316 };
317 let result = generate(&polygon, &config).unwrap();
318
319 // Should have sweeps at multiple Y levels
320 assert!(result.num_sweeps >= 3);
321 // All waypoints should be inside or on the boundary of the L-shape
322 for wp in &result.waypoints {
323 assert!(wp.x >= -0.1 && wp.x <= 4.1);
324 assert!(wp.y >= -0.1 && wp.y <= 4.1);
325 }
326 }
327
328 #[test]
329 fn narrow_corridor() {

Callers

nothing calls this directly

Calls 1

generateFunction · 0.85

Tested by

no test coverage detected