pub fn buffer_point<P>(
center: &P,
distance: f64,
strategy: PointStrategy,
) -> Ring<P>where
P: PointMut + Default + Copy,
P::Scalar: CoordinateScalar + Into<f64> + FromF64,
<P::Cs as CoordinateSystem>::Family: SameAs<CartesianFamily>,Expand description
Buffer a point by distance, producing the disc (or square)
approximation.
Mirrors the point arm of boost::geometry::buffer with a
point_circle / point_square strategy
(strategies/buffer/buffer_point_circle.hpp).
§Examples
use geometry_cs::Cartesian;
use geometry_model::Point2D;
use geometry_overlay::buffer::{buffer_point, PointStrategy};
use geometry_algorithm::ring_area;
type P = Point2D<f64, Cartesian>;
let disc = buffer_point(&P::new(0.0, 0.0), 1.0, PointStrategy::Circle { points_per_circle: 360 });
// Area of the 360-gon closely approximates π.
assert!((ring_area(&disc).abs() - core::f64::consts::PI).abs() < 1e-3);