pub struct Shape {
pub lon: f64,
pub lat: f64,
pub kind: Kind,
pub unit: Unit,
}Expand description
What is being searched for, and around where.
Fields§
§lon: f64The centre longitude.
lat: f64The centre latitude.
kind: KindA circle or a rectangle, with its size in unit.
unit: UnitWhat kind’s numbers are measured in.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn reach(&self) -> f64
pub fn reach(&self) -> f64
The radius, or the half diagonal of the rectangle, in metres.
The half diagonal and not the half width, because the step estimate has to cover the corners of the rectangle and not just its sides.
Sourcepub fn bounds(&self) -> Area
pub fn bounds(&self) -> Area
The smallest longitude and latitude rectangle that contains the shape.
The left and right edges of a shape on the sphere are curved, so the widest part of it is the edge nearer the equator. That is why the two hemispheres take their width from different edges rather than both from the centre.
Sourcepub fn covers(&self, lon: f64, lat: f64) -> Option<f64>
pub fn covers(&self, lon: f64, lat: f64) -> Option<f64>
Whether a point is inside the shape, and how far away it is in metres.
Nothing at all if it is outside, so the caller never has to compare a distance against a radius itself and get the boundary case wrong. The boundary is inclusive on both shapes.