[−][src]Struct geo::Line
A line segment made up of exactly two Point
s.
Fields
start: Coordinate<T>
end: Coordinate<T>
Implementations
impl<T> Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn new<C>(start: C, end: C) -> Line<T> where
C: Into<Coordinate<T>>,
[src]
C: Into<Coordinate<T>>,
Creates a new line segment.
Examples
use geo_types::{Coordinate, Line}; let line = Line::new(Coordinate { x: 0., y: 0. }, Coordinate { x: 1., y: 2. }); assert_eq!(line.start, Coordinate { x: 0., y: 0. }); assert_eq!(line.end, Coordinate { x: 1., y: 2. });
pub fn dx(&self) -> T
[src]
Calculate the difference in ‘x’ components (Δx).
Equivalent to:
line.end.x - line.start.x
pub fn dy(&self) -> T
[src]
Calculate the difference in ‘y’ components (Δy).
Equivalent to:
line.end.y - line.start.y
pub fn slope(&self) -> T
[src]
Calculate the slope (Δy/Δx).
Equivalent to:
line.dy() / line.dx()
Note that:
Line::new(a, b).slope() == Line::new(b, a).slope()
pub fn determinant(&self) -> T
[src]
Calculate the determinant of the line.
Equivalent to:
line.start.x * line.end.y - line.start.y * line.end.x
Note that:
Line::new(a, b).determinant() == -Line::new(b, a).determinant()
pub fn start_point(&self) -> Point<T>
[src]
pub fn end_point(&self) -> Point<T>
[src]
pub fn points(&self) -> (Point<T>, Point<T>)
[src]
Trait Implementations
impl<T> Area<T> for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn signed_area(&self) -> T
[src]
fn unsigned_area(&self) -> T
[src]
impl<T> BoundingRect<T> for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
type Output = Rect<T>
fn bounding_rect(&self) -> Self::Output
[src]
impl<T> Centroid<T> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> Clone for Line<T> where
T: Clone + CoordinateType,
[src]
T: Clone + CoordinateType,
impl<F: Float> ClosestPoint<F, Point<F>> for Line<F>
[src]
fn closest_point(&self, p: &Point<F>) -> Closest<F>
[src]
impl<T> Contains<Coordinate<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn contains(&self, coord: &Coordinate<T>) -> bool
[src]
impl<T> Contains<Line<T>> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> Contains<Line<T>> for LineString<T> where
T: Float,
[src]
T: Float,
impl<T> Contains<Line<T>> for Polygon<T> where
T: Float,
[src]
T: Float,
impl<T> Contains<LineString<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn contains(&self, linestring: &LineString<T>) -> bool
[src]
impl<T> Contains<Point<T>> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> Copy for Line<T> where
T: Copy + CoordinateType,
[src]
T: Copy + CoordinateType,
impl<T> Debug for Line<T> where
T: Debug + CoordinateType,
[src]
T: Debug + CoordinateType,
impl<T> Eq for Line<T> where
T: Eq + CoordinateType,
[src]
T: Eq + CoordinateType,
impl<T> EuclideanDistance<T, Line<T>> for Point<T> where
T: Float,
[src]
T: Float,
fn euclidean_distance(&self, line: &Line<T>) -> T
[src]
Minimum distance from a Line to a Point
impl<T> EuclideanDistance<T, Line<T>> for LineString<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
LineString to Line
fn euclidean_distance(&self, other: &Line<T>) -> T
[src]
impl<T> EuclideanDistance<T, Line<T>> for MultiPolygon<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
MultiPolygon to Line distance
fn euclidean_distance(&self, other: &Line<T>) -> T
[src]
impl<T> EuclideanDistance<T, Line<T>> for Line<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
Line to Line distance
fn euclidean_distance(&self, other: &Line<T>) -> T
[src]
impl<T> EuclideanDistance<T, Line<T>> for Polygon<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
fn euclidean_distance(&self, other: &Line<T>) -> T
[src]
impl<T> EuclideanDistance<T, LineString<T>> for Line<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
Line to LineString
fn euclidean_distance(&self, other: &LineString<T>) -> T
[src]
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Line<T> where
T: Float + FloatConst + Signed + RTreeNum,
[src]
T: Float + FloatConst + Signed + RTreeNum,
Line to MultiPolygon distance
fn euclidean_distance(&self, mpolygon: &MultiPolygon<T>) -> T
[src]
impl<T> EuclideanDistance<T, Point<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn euclidean_distance(&self, point: &Point<T>) -> T
[src]
Minimum distance from a Line to a Point
impl<T> EuclideanDistance<T, Polygon<T>> for Line<T> where
T: Float + Signed + RTreeNum + FloatConst,
[src]
T: Float + Signed + RTreeNum + FloatConst,
fn euclidean_distance(&self, other: &Polygon<T>) -> T
[src]
impl<T> EuclideanLength<T, Line<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn euclidean_length(&self) -> T
[src]
impl<T> From<[(T, T); 2]> for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T> From<Line<T>> for Geometry<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl GeodesicLength<f64, Line<f64>> for Line<f64>
[src]
fn geodesic_length(&self) -> f64
[src]
The units of the returned value is meters.
impl<T> Hash for Line<T> where
T: Hash + CoordinateType,
[src]
T: Hash + CoordinateType,
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> HaversineLength<T, Line<T>> for Line<T> where
T: Float + FromPrimitive,
[src]
T: Float + FromPrimitive,
fn haversine_length(&self) -> T
[src]
impl<T> Intersects<Line<T>> for Point<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
impl<T> Intersects<Line<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
impl<T> Intersects<Line<T>> for LineString<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
impl<T> Intersects<Line<T>> for Polygon<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
impl<T> Intersects<LineString<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, linestring: &LineString<T>) -> bool
[src]
impl<T> Intersects<Point<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, p: &Point<T>) -> bool
[src]
impl<T> Intersects<Polygon<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, p: &Polygon<T>) -> bool
[src]
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Line<T>
[src]
type Output = Line<NT>
fn map_coords(&self, func: impl Fn(&(T, T)) -> (NT, NT) + Copy) -> Self::Output
[src]
impl<T: CoordinateType> MapCoordsInplace<T> for Line<T>
[src]
impl<T> PartialEq<Line<T>> for Line<T> where
T: PartialEq<T> + CoordinateType,
[src]
T: PartialEq<T> + CoordinateType,
impl<T> PointDistance for Line<T> where
T: Float + RTreeNum,
[src]
T: Float + RTreeNum,
fn distance_2(&self, point: &Point<T>) -> T
[src]
fn contains_point(&self, point: &<Self::Envelope as Envelope>::Point) -> bool
[src]
fn distance_2_if_less_or_equal(
&self,
point: &<Self::Envelope as Envelope>::Point,
max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
[src]
&self,
point: &<Self::Envelope as Envelope>::Point,
max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
impl<T> RTreeObject for Line<T> where
T: Float + RTreeNum,
[src]
T: Float + RTreeNum,
type Envelope = AABB<Point<T>>
The object's envelope type. Usually, AABB will be the right choice. This type also defines the objects dimensionality. Read more
fn envelope(&self) -> <Line<T> as RTreeObject>::Envelope
[src]
impl<T> Rotate<T> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> StructuralEq for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T> StructuralPartialEq for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T> TryFrom<Geometry<T>> for Line<T> where
T: Float,
[src]
T: Float,
type Error = FailedToConvertError
The type returned in the event of a conversion error.
fn try_from(
geom: Geometry<T>
) -> Result<Line<T>, <Line<T> as TryFrom<Geometry<T>>>::Error>
[src]
geom: Geometry<T>
) -> Result<Line<T>, <Line<T> as TryFrom<Geometry<T>>>::Error>
impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for Line<T>
[src]
type Output = Line<NT>
fn try_map_coords(
&self,
func: impl Fn(&(T, T)) -> Result<(NT, NT), Box<dyn Error + Send + Sync>> + Copy
) -> Result<Self::Output, Box<dyn Error + Send + Sync>>
[src]
&self,
func: impl Fn(&(T, T)) -> Result<(NT, NT), Box<dyn Error + Send + Sync>> + Copy
) -> Result<Self::Output, Box<dyn Error + Send + Sync>>
impl<T> VincentyLength<T, Line<T>> for Line<T> where
T: Float + FromPrimitive,
[src]
T: Float + FromPrimitive,
fn vincenty_length(&self) -> Result<T, FailedToConvergeError>
[src]
The units of the returned value is meters.
Auto Trait Implementations
impl<T> RefUnwindSafe for Line<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Line<T> where
T: Send,
T: Send,
impl<T> Sync for Line<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Line<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Line<T> where
T: UnwindSafe,
T: UnwindSafe,
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<P> PointDistance for P where
P: Point,
[src]
P: Point,
fn distance_2(&self, point: &P) -> <P as Point>::Scalar
[src]
fn contains_point(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point
) -> bool
[src]
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point
) -> bool
fn distance_2_if_less_or_equal(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point,
max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<P as Point>::Scalar>
[src]
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point,
max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<P as Point>::Scalar>
impl<P> RTreeObject for P where
P: Point,
[src]
P: Point,
type Envelope = AABB<P>
The object's envelope type. Usually, AABB will be the right choice. This type also defines the objects dimensionality. Read more
fn envelope(&self) -> AABB<P>
[src]
impl<T, G> RotatePoint<T> for G where
G: MapCoords<T, T, Output = G>,
T: Float,
[src]
G: MapCoords<T, T, Output = G>,
T: Float,
fn rotate_around_point(&Self, T, Point<T>) -> G
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, G> Translate<T> for G where
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
T: CoordinateType,
[src]
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
T: CoordinateType,
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>,