[−][src]Struct transit_model::objects::Approx
Proxy object to compute approximate distances.
Implementations
impl Approx
[src]
pub fn sq_distance_to(&self, coord: &Coord) -> f64
[src]
Returns the squared distance to coord
. Squared distance is
returned to skip a sqrt
call, that is not important for
distance comparison or sorting.
Example
let v: Vec<Coord> = get_coords(); let from = Coord { lon: 2.37715, lat: 48.846_781 }; let one_km_squared = 1_000. * 1_000.; let approx = from.approx(); for coord in &v { if approx.sq_distance_to(coord) < one_km_squared { println!("{:?} is within 1km", coord); } }
Auto Trait Implementations
impl RefUnwindSafe for Approx
impl Send for Approx
impl Sync for Approx
impl Unpin for Approx
impl UnwindSafe for Approx
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,