MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / buffer_polygon_expands

Function buffer_polygon_expands

nodedb-spatial/src/operations.rs:405–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

403
404 #[test]
405 fn buffer_polygon_expands() {
406 let poly = Geometry::polygon(vec![vec![
407 [0.0, 0.0],
408 [1.0, 0.0],
409 [1.0, 1.0],
410 [0.0, 1.0],
411 [0.0, 0.0],
412 ]]);
413 let buf = st_buffer(&poly, 1000.0, 32);
414 if let Geometry::Polygon { .. } = &buf {
415 let orig_bb = geometry_bbox(&poly);
416 let buf_bb = geometry_bbox(&buf);
417 // Buffered should be larger.
418 assert!(buf_bb.min_lng < orig_bb.min_lng);
419 assert!(buf_bb.max_lng > orig_bb.max_lng);
420 assert!(buf_bb.min_lat < orig_bb.min_lat);
421 assert!(buf_bb.max_lat > orig_bb.max_lat);
422 } else {
423 panic!("expected Polygon");
424 }
425 }
426}

Callers

nothing calls this directly

Calls 2

st_bufferFunction · 0.85
geometry_bboxFunction · 0.85

Tested by

no test coverage detected