Struct geo::Line [−][src]
pub struct Line<T> where
T: CoordinateType, { pub start: Point<T>, pub end: Point<T>, }
A line segment made up of exactly two Points
Fields
start: Point<T>
end: Point<T>
Methods
impl<T> Line<T> where
T: CoordinateType, [src]
impl<T> Line<T> where
T: CoordinateType, pub fn new(start: Point<T>, end: Point<T>) -> Line<T>[src]
pub fn new(start: Point<T>, end: Point<T>) -> Line<T>Creates a new line segment.
use geo_types::{Point, Line}; let line = Line::new(Point::new(0., 0.), Point::new(1., 2.)); assert_eq!(line.start, Point::new(0., 0.)); assert_eq!(line.end, Point::new(1., 2.));
Trait Implementations
impl<T> SpatialObject for Line<T> where
T: Float + SpadeNum + Debug, [src]
impl<T> SpatialObject for Line<T> where
T: Float + SpadeNum + Debug, type Point = Point<T>
The object's point type.
fn mbr(&self) -> BoundingRect<<Line<T> as SpatialObject>::Point>[src]
fn mbr(&self) -> BoundingRect<<Line<T> as SpatialObject>::Point>Returns the object's minimal bounding rectangle. Read more
fn distance2(
&self,
point: &<Line<T> as SpatialObject>::Point
) -> <<Line<T> as SpatialObject>::Point as PointN>::Scalar[src]
fn distance2(
&self,
point: &<Line<T> as SpatialObject>::Point
) -> <<Line<T> as SpatialObject>::Point as PointN>::ScalarReturns the squared euclidean distance from the object's contour. Returns a value samller than zero if the point is contained within the object. Read more
fn contains(&self, point: &Self::Point) -> bool[src]
fn contains(&self, point: &Self::Point) -> boolReturns true if a given point is contained in this object.
impl<T> Clone for Line<T> where
T: Clone + CoordinateType, [src]
impl<T> Clone for Line<T> where
T: Clone + CoordinateType, fn clone(&self) -> Line<T>[src]
fn clone(&self) -> Line<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<T> Debug for Line<T> where
T: Debug + CoordinateType, [src]
impl<T> Debug for Line<T> where
T: Debug + CoordinateType, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl<T> Copy for Line<T> where
T: Copy + CoordinateType, [src]
impl<T> Copy for Line<T> where
T: Copy + CoordinateType, impl<T> PartialEq<Line<T>> for Line<T> where
T: PartialEq<T> + CoordinateType, [src]
impl<T> PartialEq<Line<T>> for Line<T> where
T: PartialEq<T> + CoordinateType, fn eq(&self, other: &Line<T>) -> bool[src]
fn eq(&self, other: &Line<T>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Line<T>) -> bool[src]
fn ne(&self, other: &Line<T>) -> boolThis method tests for !=.
impl<T> Centroid<T> for Line<T> where
T: Float, [src]
impl<T> Centroid<T> for Line<T> where
T: Float, type Output = Point<T>
fn centroid(&self) -> Self::Output[src]
fn centroid(&self) -> Self::OutputSee: https://en.wikipedia.org/wiki/Centroid Read more
impl<T> Contains<Point<T>> for Line<T> where
T: Float, [src]
impl<T> Contains<Point<T>> for Line<T> where
T: Float, fn contains(&self, p: &Point<T>) -> bool[src]
fn contains(&self, p: &Point<T>) -> boolChecks if rhs is completely contained within self. Read more
impl<T> Contains<Line<T>> for Line<T> where
T: Float, [src]
impl<T> Contains<Line<T>> for Line<T> where
T: Float, fn contains(&self, line: &Line<T>) -> bool[src]
fn contains(&self, line: &Line<T>) -> boolChecks if rhs is completely contained within self. Read more
impl<T> Contains<LineString<T>> for Line<T> where
T: Float, [src]
impl<T> Contains<LineString<T>> for Line<T> where
T: Float, fn contains(&self, linestring: &LineString<T>) -> bool[src]
fn contains(&self, linestring: &LineString<T>) -> boolChecks if rhs is completely contained within self. Read more
impl<T> Contains<Line<T>> for LineString<T> where
T: Float, [src]
impl<T> Contains<Line<T>> for LineString<T> where
T: Float, fn contains(&self, line: &Line<T>) -> bool[src]
fn contains(&self, line: &Line<T>) -> boolChecks if rhs is completely contained within self. Read more
impl<T> Contains<Line<T>> for Polygon<T> where
T: Float, [src]
impl<T> Contains<Line<T>> for Polygon<T> where
T: Float, fn contains(&self, line: &Line<T>) -> bool[src]
fn contains(&self, line: &Line<T>) -> boolChecks if rhs is completely contained within self. Read more
impl<T> Intersects<Point<T>> for Line<T> where
T: Float, [src]
impl<T> Intersects<Point<T>> for Line<T> where
T: Float, fn intersects(&self, p: &Point<T>) -> bool[src]
fn intersects(&self, p: &Point<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Point<T> where
T: Float, [src]
impl<T> Intersects<Line<T>> for Point<T> where
T: Float, fn intersects(&self, line: &Line<T>) -> bool[src]
fn intersects(&self, line: &Line<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Line<T> where
T: Float, [src]
impl<T> Intersects<Line<T>> for Line<T> where
T: Float, fn intersects(&self, line: &Line<T>) -> bool[src]
fn intersects(&self, line: &Line<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<LineString<T>> for Line<T> where
T: Float, [src]
impl<T> Intersects<LineString<T>> for Line<T> where
T: Float, fn intersects(&self, linestring: &LineString<T>) -> bool[src]
fn intersects(&self, linestring: &LineString<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for LineString<T> where
T: Float, [src]
impl<T> Intersects<Line<T>> for LineString<T> where
T: Float, fn intersects(&self, line: &Line<T>) -> bool[src]
fn intersects(&self, line: &Line<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Polygon<T>> for Line<T> where
T: Float, [src]
impl<T> Intersects<Polygon<T>> for Line<T> where
T: Float, fn intersects(&self, p: &Polygon<T>) -> bool[src]
fn intersects(&self, p: &Polygon<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Polygon<T> where
T: Float, [src]
impl<T> Intersects<Line<T>> for Polygon<T> where
T: Float, fn intersects(&self, line: &Line<T>) -> bool[src]
fn intersects(&self, line: &Line<T>) -> boolChecks if the geometry A intersects the geometry B. Read more
impl<T> Area<T> for Line<T> where
T: Float, [src]
impl<T> Area<T> for Line<T> where
T: Float, impl<T> EuclideanLength<T> for Line<T> where
T: Float, [src]
impl<T> EuclideanLength<T> for Line<T> where
T: Float, fn euclidean_length(&self) -> T[src]
fn euclidean_length(&self) -> TCalculation of the length of a Line Read more
impl<T> EuclideanDistance<T, Point<T>> for Line<T> where
T: Float, [src]
impl<T> EuclideanDistance<T, Point<T>> for Line<T> where
T: Float, fn euclidean_distance(&self, point: &Point<T>) -> T[src]
fn euclidean_distance(&self, point: &Point<T>) -> TMinimum distance from a Line to a Point
impl<T> EuclideanDistance<T, Line<T>> for Point<T> where
T: Float, [src]
impl<T> EuclideanDistance<T, Line<T>> for Point<T> where
T: Float, fn euclidean_distance(&self, line: &Line<T>) -> T[src]
fn euclidean_distance(&self, line: &Line<T>) -> TMinimum distance from a Line to a Point
impl<T> EuclideanDistance<T, Line<T>> for LineString<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, Line<T>> for LineString<T> where
T: Float + FloatConst + Signed + SpadeFloat, LineString to Line
fn euclidean_distance(&self, other: &Line<T>) -> T[src]
fn euclidean_distance(&self, other: &Line<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, LineString<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, LineString<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, Line to LineString
fn euclidean_distance(&self, other: &LineString<T>) -> T[src]
fn euclidean_distance(&self, other: &LineString<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, Line to MultiPolygon distance
fn euclidean_distance(&self, mpolygon: &MultiPolygon<T>) -> T[src]
fn euclidean_distance(&self, mpolygon: &MultiPolygon<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, Line<T>> for MultiPolygon<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, Line<T>> for MultiPolygon<T> where
T: Float + FloatConst + Signed + SpadeFloat, MultiPolygon to Line distance
fn euclidean_distance(&self, other: &Line<T>) -> T[src]
fn euclidean_distance(&self, other: &Line<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, Line<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, Line<T>> for Line<T> where
T: Float + FloatConst + Signed + SpadeFloat, Line to Line distance
fn euclidean_distance(&self, other: &Line<T>) -> T[src]
fn euclidean_distance(&self, other: &Line<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, Polygon<T>> for Line<T> where
T: Float + Signed + SpadeFloat + FloatConst, [src]
impl<T> EuclideanDistance<T, Polygon<T>> for Line<T> where
T: Float + Signed + SpadeFloat + FloatConst, fn euclidean_distance(&self, other: &Polygon<T>) -> T[src]
fn euclidean_distance(&self, other: &Polygon<T>) -> TReturns the distance between two geometries Read more
impl<T> EuclideanDistance<T, Line<T>> for Polygon<T> where
T: Float + FloatConst + Signed + SpadeFloat, [src]
impl<T> EuclideanDistance<T, Line<T>> for Polygon<T> where
T: Float + FloatConst + Signed + SpadeFloat, fn euclidean_distance(&self, other: &Line<T>) -> T[src]
fn euclidean_distance(&self, other: &Line<T>) -> TReturns the distance between two geometries Read more
impl<T> BoundingBox<T> for Line<T> where
T: CoordinateType, [src]
impl<T> BoundingBox<T> for Line<T> where
T: CoordinateType, type Output = Bbox<T>
fn bbox(&self) -> Self::Output[src]
fn bbox(&self) -> Self::OutputReturn the Bounding Box of a geometry Read more
impl<T> Rotate<T> for Line<T> where
T: Float, [src]
impl<T> Rotate<T> for Line<T> where
T: Float, fn rotate(&self, angle: T) -> Self[src]
fn rotate(&self, angle: T) -> SelfRotate a Geometry around its centroid by an angle, in degrees Read more
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Line<T>[src]
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Line<T>type Output = Line<NT>
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::Output[src]
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::OutputApply a function to all the coordinates in a geometric object, returning a new object. Read more
impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for Line<T>[src]
impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for Line<T>type Output = Line<NT>
fn try_map_coords(
&self,
func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
) -> Result<Self::Output, Error>[src]
fn try_map_coords(
&self,
func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
) -> Result<Self::Output, Error>Map a fallible function over all the coordinates in a geometry, returning a Result Read more
impl<T: CoordinateType> MapCoordsInplace<T> for Line<T>[src]
impl<T: CoordinateType> MapCoordsInplace<T> for Line<T>fn map_coords_inplace(&mut self, func: &Fn(&(T, T)) -> (T, T))[src]
fn map_coords_inplace(&mut self, func: &Fn(&(T, T)) -> (T, T))Apply a function to all the coordinates in a geometric object, in place Read more
impl<F: Float> ClosestPoint<F> for Line<F>[src]
impl<F: Float> ClosestPoint<F> for Line<F>fn closest_point(&self, p: &Point<F>) -> Closest<F>[src]
fn closest_point(&self, p: &Point<F>) -> Closest<F>Find the closest point between self and p.
impl<T> HaversineLength<T> for Line<T> where
T: Float + FromPrimitive, [src]
impl<T> HaversineLength<T> for Line<T> where
T: Float + FromPrimitive, fn haversine_length(&self) -> T[src]
fn haversine_length(&self) -> TCalculation of the length of a Line Read more
impl<T> VincentyLength<T> for Line<T> where
T: Float + FromPrimitive, [src]
impl<T> VincentyLength<T> for Line<T> where
T: Float + FromPrimitive, fn vincenty_length(&self) -> Result<T, FailedToConvergeError>[src]
fn vincenty_length(&self) -> Result<T, FailedToConvergeError>The units of the returned value is meters.