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

Function buffer_point_circle

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

Source from the content-addressed store, hash-verified

302
303 #[test]
304 fn buffer_point_circle() {
305 let circle = st_buffer(&Geometry::point(0.0, 0.0), 1000.0, 32);
306 if let Geometry::Polygon { coordinates } = &circle {
307 assert_eq!(coordinates.len(), 1);
308 // 32 segments + 1 closing point.
309 assert_eq!(coordinates[0].len(), 33);
310 // All points should be roughly 1000m from center.
311 for pt in &coordinates[0][..32] {
312 let d = nodedb_types::geometry::haversine_distance(0.0, 0.0, pt[0], pt[1]);
313 assert!((d - 1000.0).abs() < 50.0, "d={d}");
314 }
315 } else {
316 panic!("expected Polygon");
317 }
318 }
319
320 #[test]
321 fn buffer_point_4_segments() {

Callers

nothing calls this directly

Calls 2

st_bufferFunction · 0.85
haversine_distanceFunction · 0.85

Tested by

no test coverage detected