[−][src]Struct spade::primitives::SimpleEdge
An edge defined by it's two end points.
Fields
from: V
The edge's origin.
to: V
The edge's destination.
Methods
impl<V> SimpleEdge<V> where
V: PointN,
[src]
V: PointN,
pub fn new(from: V, to: V) -> SimpleEdge<V>
[src]
Creates a new edge from from
to to
.
pub fn is_projection_on_edge(&self, query_point: &V) -> bool
[src]
Projects a point onto the infinite line going through the
edge's start and end point and returns true
if the projected
points lies between from
and to
.
pub fn length2(&self) -> V::Scalar
[src]
Returns the edge's squared length.
impl<V> SimpleEdge<V> where
V: TwoDimensional,
[src]
V: TwoDimensional,
pub fn side_query<K: DelaunayKernel<V::Scalar>>(
&self,
q: &V
) -> EdgeSideInfo<V::Scalar>
[src]
&self,
q: &V
) -> EdgeSideInfo<V::Scalar>
Determines on which side of this edge a given point lies.
Example:
use nalgebra::Point2; use spade::kernels::TrivialKernel; use spade::primitives::SimpleEdge; let e = SimpleEdge::new(Point2::new(0f32, 0.), Point2::new(1., 1.)); assert!(e.side_query::<TrivialKernel>(&Point2::new(1.0, 0.0)).is_on_right_side()); assert!(e.side_query::<TrivialKernel>(&Point2::new(0.0, 1.0)).is_on_left_side()); assert!(e.side_query::<TrivialKernel>(&Point2::new(0.5, 0.5)).is_on_line());
pub fn intersects_edge_non_collinear<K>(&self, other: &SimpleEdge<V>) -> bool where
K: DelaunayKernel<V::Scalar>,
[src]
K: DelaunayKernel<V::Scalar>,
Checks if this and another edge intersect.
The edges must not be collinear. Also, true
is returned if the edges
just touch each other.
Panics
Panics if both lines are collinear.
impl<V> SimpleEdge<V> where
V: PointN,
V::Scalar: SpadeFloat,
[src]
V: PointN,
V::Scalar: SpadeFloat,
pub fn nearest_point(&self, query_point: &V) -> V
[src]
Yields the nearest point on this edge.
pub fn projection_distance2(&self, query_point: &V) -> V::Scalar
[src]
Returns the squared distance of a given point to its projection onto the infinite line going through this edge's start and end point.
pub fn project_point(&self, query_point: &V) -> V::Scalar
[src]
Projects a point on this line and returns its relative position.
This method will return a value between 0. and 1. (linearly interpolated) if the projected
point lies between self.from
and self.to
, a value close to zero (due to rounding errors)
if the projected point is equal to self.from
and a value smaller than zero if the projected
point lies "before" self.from
. Analogously, a value close to 1. or greater than 1. is
returned if the projected point is equal to or lies behind self.to
.
Trait Implementations
impl<V: PointN> SpatialObject for SimpleEdge<V> where
V::Scalar: SpadeFloat,
[src]
V::Scalar: SpadeFloat,
type Point = V
The object's point type.
fn mbr(&self) -> BoundingRect<V>
[src]
fn distance2(&self, point: &V) -> V::Scalar
[src]
fn contains(&self, point: &Self::Point) -> bool
[src]
impl<V: Eq + PointN> Eq for SimpleEdge<V>
[src]
impl<V: Clone + PointN> Clone for SimpleEdge<V>
[src]
fn clone(&self) -> SimpleEdge<V>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<V: PartialOrd + PointN> PartialOrd<SimpleEdge<V>> for SimpleEdge<V>
[src]
fn partial_cmp(&self, other: &SimpleEdge<V>) -> Option<Ordering>
[src]
fn lt(&self, other: &SimpleEdge<V>) -> bool
[src]
fn le(&self, other: &SimpleEdge<V>) -> bool
[src]
fn gt(&self, other: &SimpleEdge<V>) -> bool
[src]
fn ge(&self, other: &SimpleEdge<V>) -> bool
[src]
impl<V: Ord + PointN> Ord for SimpleEdge<V>
[src]
fn cmp(&self, other: &SimpleEdge<V>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<V: PartialEq + PointN> PartialEq<SimpleEdge<V>> for SimpleEdge<V>
[src]
fn eq(&self, other: &SimpleEdge<V>) -> bool
[src]
fn ne(&self, other: &SimpleEdge<V>) -> bool
[src]
impl<V: Copy + PointN> Copy for SimpleEdge<V>
[src]
impl<V: Hash + PointN> Hash for SimpleEdge<V>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<V: Debug + PointN> Debug for SimpleEdge<V>
[src]
Auto Trait Implementations
impl<V> Unpin for SimpleEdge<V> where
V: Unpin,
V: Unpin,
impl<V> Sync for SimpleEdge<V> where
V: Sync,
V: Sync,
impl<V> Send for SimpleEdge<V> where
V: Send,
V: Send,
impl<V> UnwindSafe for SimpleEdge<V> where
V: UnwindSafe,
V: UnwindSafe,
impl<V> RefUnwindSafe for SimpleEdge<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Scalar for T where
T: Copy + PartialEq<T> + Any + Debug,
[src]
T: Copy + PartialEq<T> + Any + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,