[][src]Trait geo::algorithm::coordinate_position::CoordinatePosition

pub trait CoordinatePosition {
    type Scalar: HasKernel;
    pub fn calculate_coordinate_position(
        &self,
        coord: &Coordinate<Self::Scalar>,
        is_inside: &mut bool,
        boundary_count: &mut usize
    ); pub fn coordinate_position(
        &self,
        coord: &Coordinate<Self::Scalar>
    ) -> CoordPos { ... } }

Determine whether a Coordinate lies inside, outside, or on the boundary of a geometry.

Examples

use geo::{polygon, Coordinate};
use geo::coordinate_position::{CoordinatePosition, CoordPos};

let square_poly = polygon![(x: 0.0, y: 0.0), (x: 2.0, y: 0.0), (x: 2.0, y: 2.0), (x: 0.0, y: 2.0), (x: 0.0, y: 0.0)];

let inside_coord = Coordinate { x: 1.0, y: 1.0 };
assert_eq!(square_poly.coordinate_position(&inside_coord), CoordPos::Inside);

let boundary_coord = Coordinate { x: 0.0, y: 1.0 };
assert_eq!(square_poly.coordinate_position(&boundary_coord), CoordPos::OnBoundary);

let outside_coord = Coordinate { x: 5.0, y: 5.0 };
assert_eq!(square_poly.coordinate_position(&outside_coord), CoordPos::Outside);

Associated Types

type Scalar: HasKernel[src]

Loading content...

Required methods

pub fn calculate_coordinate_position(
    &self,
    coord: &Coordinate<Self::Scalar>,
    is_inside: &mut bool,
    boundary_count: &mut usize
)
[src]

Loading content...

Provided methods

pub fn coordinate_position(&self, coord: &Coordinate<Self::Scalar>) -> CoordPos[src]

Loading content...

Implementors

impl<T> CoordinatePosition for Geometry<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Coordinate<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for GeometryCollection<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Line<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for LineString<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for MultiLineString<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for MultiPoint<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for MultiPolygon<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Point<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Polygon<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Rect<T> where
    T: HasKernel, 
[src]

type Scalar = T

impl<T> CoordinatePosition for Triangle<T> where
    T: HasKernel, 
[src]

type Scalar = T

Loading content...