pub struct Edge {
pub start: Point,
pub end: Point,
}
Expand description
Line segment between two Point
s
Fields§
§start: Point
§end: Point
Implementations§
Source§impl Edge
impl Edge
pub fn try_new(start: Point, end: Point) -> Result<Self>
pub fn extend_at_front(self, d: f32) -> Self
pub fn extend_at_back(self, d: f32) -> Self
pub fn scale(self, factor: f32) -> 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) -> f32
pub fn y_min(&self) -> f32
pub fn x_max(&self) -> f32
pub fn y_max(&self) -> f32
pub fn length(&self) -> f32
pub fn centroid(&self) -> Point
Trait Implementations§
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 CollidesWith<Edge> for Rect
impl CollidesWith<Edge> for Rect
fn collides_with(&self, edge: &Edge) -> bool
Source§impl CollidesWith<Rect> for Edge
impl CollidesWith<Rect> for Edge
fn collides_with(&self, other: &Rect) -> bool
Source§impl DistanceTo<Edge> for Circle
impl DistanceTo<Edge> for Circle
Source§fn distance_to(&self, e: &Edge) -> f32
fn distance_to(&self, e: &Edge) -> f32
Minimum distance between two primitives. Will be 0 in case of a collision.
Source§fn sq_distance_to(&self, e: &Edge) -> f32
fn sq_distance_to(&self, e: &Edge) -> f32
Squared version of DistanceTo::distance_to
Source§impl DistanceTo<Point> for Edge
impl DistanceTo<Point> for Edge
Source§fn distance_to(&self, point: &Point) -> f32
fn distance_to(&self, point: &Point) -> f32
Minimum distance between two primitives. Will be 0 in case of a collision.
Source§fn sq_distance_to(&self, point: &Point) -> f32
fn sq_distance_to(&self, point: &Point) -> f32
Squared version of DistanceTo::distance_to
Source§impl SeparationDistance<Edge> for Circle
impl SeparationDistance<Edge> for Circle
Source§fn separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
fn separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
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 DistanceTo::distance_to)Source§fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
Squared version of SeparationDistance::separation_distance
Source§impl Transformable for Edge
impl Transformable for Edge
Source§fn transform(&mut self, t: &Transformation) -> &mut Self
fn transform(&mut self, t: &Transformation) -> &mut Self
Applies a transformation to
self
.Source§fn transform_clone(&self, t: &Transformation) -> Self
fn transform_clone(&self, t: &Transformation) -> Self
Applies a transformation to a clone.
Source§impl TransformableFrom for Edge
impl TransformableFrom for Edge
Source§fn transform_from(&mut self, reference: &Self, t: &Transformation) -> &mut Self
fn transform_from(&mut self, reference: &Self, t: &Transformation) -> &mut Self
Applies a transformation on the reference object and stores the result in
self
.impl Copy 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