pub struct Edge {
pub start: Point,
pub end: Point,
}
Expand description
Geometric primitive representing a line segment
Fields§
§start: Point
§end: Point
Implementations§
Source§impl Edge
impl Edge
pub fn new(start: Point, end: Point) -> Self
pub fn extend_at_front(self, d: fsize) -> Self
pub fn extend_at_back(self, d: fsize) -> Self
pub fn scale(self, factor: fsize) -> Self
pub fn reverse(self) -> Self
pub fn collides_at(&self, other: &Edge) -> Option<Point>
Sourcepub fn closest_point_on_edge(&self, point: &Point) -> Point
pub fn closest_point_on_edge(&self, point: &Point) -> Point
Returns the closest point which lies on the edge to the given point
pub fn x_min(&self) -> fsize
pub fn y_min(&self) -> fsize
pub fn x_max(&self) -> fsize
pub fn y_max(&self) -> fsize
Trait Implementations§
Source§impl CollidesWith<AARectangle> for Edge
impl CollidesWith<AARectangle> for Edge
fn collides_with(&self, other: &AARectangle) -> bool
Source§impl CollidesWith<Edge> for AARectangle
impl CollidesWith<Edge> for AARectangle
fn collides_with(&self, edge: &Edge) -> bool
Source§impl CollidesWith<Edge> for Circle
impl CollidesWith<Edge> for Circle
fn collides_with(&self, edge: &Edge) -> bool
Source§impl CollidesWith<Edge> for Edge
impl CollidesWith<Edge> for Edge
fn collides_with(&self, other: &Edge) -> bool
Source§impl SeparationDistance<Edge> for Circle
impl SeparationDistance<Edge> for Circle
Source§fn separation_distance(&self, e: &Edge) -> (GeoPosition, fsize)
fn separation_distance(&self, e: &Edge) -> (GeoPosition, fsize)
In case of a collision between
self
and other
, returns GeoPosition::Interior and the minimum distance to separate the two primitives.
Otherwise, returns GeoPosition::Exterior and the minimum distance between the two primitives. (similar to Distance::distance)Source§fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, fsize)
fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, fsize)
Squared version of SeparationDistance::separation_distance
Source§impl Transformable for Edge
impl Transformable for Edge
fn transform(&mut self, t: &Transformation) -> &mut Self
fn transform_clone(&self, t: &Transformation) -> Self
Source§impl TransformableFrom for Edge
impl TransformableFrom for Edge
fn transform_from(&mut self, reference: &Self, t: &Transformation) -> &mut Self
impl QTQueryable for Edge
impl StructuralPartialEq for Edge
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl Sync for Edge
impl Unpin for Edge
impl UnwindSafe for Edge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more