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 Point
s
Fields
start: Point<T>
end: Point<T>
Methods
impl<T> Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn new(start: Point<T>, end: Point<T>) -> Line<T>
[src]
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<'de, T> Deserialize<'de> for Line<T> where
T: CoordinateType + Deserialize<'de>,
[src]
T: CoordinateType + Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Line<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Line<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T> Serialize for Line<T> where
T: CoordinateType + Serialize,
[src]
T: CoordinateType + Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Line<T> where
T: Copy + CoordinateType,
[src]
T: Copy + CoordinateType,
impl<T> SpatialObject for Line<T> where
T: Float + SpadeNum + Debug,
[src]
T: Float + SpadeNum + Debug,
type Point = Point<T>
The object's point type.
fn mbr(&self) -> BoundingRect<<Line<T> as SpatialObject>::Point>
[src]
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]
&self,
point: &<Line<T> as SpatialObject>::Point
) -> <<Line<T> as SpatialObject>::Point as PointN>::Scalar
Returns 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]
Returns true if a given point is contained in this object.
impl<T> PartialEq<Line<T>> for Line<T> where
T: PartialEq<T> + CoordinateType,
[src]
T: PartialEq<T> + CoordinateType,
fn eq(&self, __arg_0: &Line<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Line<T>) -> bool
[src]
This method tests for !=
.
impl<T> Clone for Line<T> where
T: Clone + CoordinateType,
[src]
T: Clone + CoordinateType,
fn clone(&self) -> Line<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> Debug for Line<T> where
T: Debug + CoordinateType,
[src]
T: Debug + CoordinateType,
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl<T> Centroid<T> for Line<T> where
T: Float,
[src]
T: Float,
type Output = Point<T>
fn centroid(&self) -> Self::Output
[src]
See: https://en.wikipedia.org/wiki/Centroid Read more
impl<T> Contains<Point<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn contains(&self, p: &Point<T>) -> bool
[src]
Checks if the geometry A is completely inside the B geometry. Read more
impl<T> Contains<Line<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn contains(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A is completely inside the B geometry. Read more
impl<T> Contains<LineString<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn contains(&self, linestring: &LineString<T>) -> bool
[src]
Checks if the geometry A is completely inside the B geometry. Read more
impl<T> Contains<Line<T>> for LineString<T> where
T: Float,
[src]
T: Float,
fn contains(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A is completely inside the B geometry. Read more
impl<T> Contains<Line<T>> for Polygon<T> where
T: Float,
[src]
T: Float,
fn contains(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A is completely inside the B geometry. Read more
impl<T> Intersects<Point<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, p: &Point<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Point<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<LineString<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, linestring: &LineString<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for LineString<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Polygon<T>> for Line<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, p: &Polygon<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Intersects<Line<T>> for Polygon<T> where
T: Float,
[src]
T: Float,
fn intersects(&self, line: &Line<T>) -> bool
[src]
Checks if the geometry A intersects the geometry B. Read more
impl<T> Area<T> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> EuclideanLength<T> for Line<T> where
T: Float,
[src]
T: Float,
fn euclidean_length(&self) -> T
[src]
Calculation of the length of a Line Read more
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, Line<T>> for Point<T> where
T: Float,
[src]
T: Float,
fn euclidean_distance(&self, line: &Line<T>) -> T
[src]
Minimum istance from a Line to a Point
impl<T> BoundingBox<T> for Line<T> where
T: CoordinateType,
[src]
T: CoordinateType,
type Output = Bbox<T>
fn bbox(&self) -> Self::Output
[src]
Return the Bounding Box of a geometry Read more
impl<T> Rotate<T> for Line<T> where
T: Float,
[src]
T: Float,
fn rotate(&self, angle: T) -> Self
[src]
Rotate a Geometry around its centroid by an angle, in degrees Read more
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Line<T>
[src]
type Output = Line<NT>
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::Output
[src]
Apply 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]
type Output = Line<NT>
fn try_map_coords(
&self,
func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
) -> Result<Self::Output, Error>
[src]
&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]
fn map_coords_inplace(&mut self, func: &Fn(&(T, T)) -> (T, T))
[src]
Apply a function to all the coordinates in a geometric object, in place Read more
impl<F: Float> ClosestPoint<F> for Line<F>
[src]
fn closest_point(&self, p: &Point<F>) -> Closest<F>
[src]
Find the closest point between self
and p
.
impl<T> HaversineLength<T> for Line<T> where
T: Float + FromPrimitive,
[src]
T: Float + FromPrimitive,
fn haversine_length(&self) -> T
[src]
Calculation of the length of a Line Read more