pub struct RansacLineModel {
pub a: f64,
pub b: f64,
pub c: f64,
}Expand description
A 2D line in implicit form a x + b y + c = 0 with the normal (a, b)
normalized so that a² + b² = 1.
Fields§
§a: f64x coefficient of the normal.
b: f64y coefficient of the normal.
c: f64Signed offset.
Implementations§
Source§impl RansacLineModel
impl RansacLineModel
Sourcepub fn from_two_points(p1: Point, p2: Point) -> Option<Self>
pub fn from_two_points(p1: Point, p2: Point) -> Option<Self>
Builds a line through two points.
Returns None when the points are coincident (within
DEGENERATE_EPSILON). The normal (a, b) is perpendicular to the
direction p2 - p1.
Sourcepub fn distance_to(&self, p: Point) -> f64
pub fn distance_to(&self, p: Point) -> f64
Perpendicular distance from a point to the line (a, b normalized).
Sourcepub fn point_on_line(&self) -> (f64, f64)
pub fn point_on_line(&self) -> (f64, f64)
The point on the line closest to the origin: (-a*c, -b*c).
Trait Implementations§
Source§impl Clone for RansacLineModel
impl Clone for RansacLineModel
Source§fn clone(&self) -> RansacLineModel
fn clone(&self) -> RansacLineModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RansacLineModel
Source§impl Debug for RansacLineModel
impl Debug for RansacLineModel
Source§impl PartialEq for RansacLineModel
impl PartialEq for RansacLineModel
Source§fn eq(&self, other: &RansacLineModel) -> bool
fn eq(&self, other: &RansacLineModel) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RansacLineModel
Auto Trait Implementations§
impl Freeze for RansacLineModel
impl RefUnwindSafe for RansacLineModel
impl Send for RansacLineModel
impl Sync for RansacLineModel
impl Unpin for RansacLineModel
impl UnsafeUnpin for RansacLineModel
impl UnwindSafe for RansacLineModel
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