pub struct Edge {
pub a: Point,
pub b: Point,
}Expand description
One directed edge from a to b. Edges with a == b are valid but
don’t contribute to most operators (they’re zero-length).
Fields§
§a: Point§b: PointImplementations§
Source§impl Edge
impl Edge
pub const fn new(a: Point, b: Point) -> Self
pub fn dx(&self) -> i64
pub fn dy(&self) -> i64
pub fn length_squared(&self) -> i128
pub fn length(&self) -> f64
pub fn midpoint(&self) -> Point
pub fn bbox(&self) -> Bbox
Sourcepub fn angle_degrees(&self) -> f64
pub fn angle_degrees(&self) -> f64
Angle in degrees from the +X axis, normalized to [0, 180).
Reverse-direction edges have the same angle as their forward
counterpart — useful for “edges parallel to direction X”.
pub fn is_horizontal(&self) -> bool
pub fn is_vertical(&self) -> bool
pub fn is_axis_aligned(&self) -> bool
Trait Implementations§
impl Copy for Edge
impl Eq 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 UnsafeUnpin 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