pub struct InfiniteLine<T: CoordinateScalar = f64> {
pub a: T,
pub b: T,
pub c: T,
pub normalized: bool,
}Expand description
An infinite line in the general form a*x + b*y + c = 0.
Mirrors model::infinite_line<Type> from
geometries/infinite_line.hpp:35-52. It is intentionally not a
geometry_trait::Geometry because the C++ source likewise notes that the
type is not conceptized.
Fields§
§a: TCoefficient of x. A horizontal line has a == 0.
b: TCoefficient of y. A vertical line has b == 0.
c: TConstant term. A line through the origin has c == 0.
normalized: boolWhether the coefficients have been normalized by a caller.
Implementations§
Source§impl<T: CoordinateScalar> InfiniteLine<T>
impl<T: CoordinateScalar> InfiniteLine<T>
Sourcepub const fn new(a: T, b: T, c: T) -> Self
pub const fn new(a: T, b: T, c: T) -> Self
Construct a line from its general-form coefficients.
Sourcepub fn from_coordinates(x1: T, y1: T, x2: T, y2: T) -> Self
pub fn from_coordinates(x1: T, y1: T, x2: T, y2: T) -> Self
Construct the infinite line through (x1, y1) and (x2, y2).
Mirrors detail::make::make_infinite_line from
algorithms/detail/make/make.hpp:21-32:
a = y1-y2, b = x2-x1, c = -a*x1-b*y1.
Sourcepub fn from_points<P>(start: &P, end: &P) -> Selfwhere
P: Point<Scalar = T>,
pub fn from_points<P>(start: &P, end: &P) -> Selfwhere
P: Point<Scalar = T>,
Construct the infinite line through two points.
Mirrors make_infinite_line(PointA, PointB) from
algorithms/detail/make/make.hpp:34-40.
Sourcepub fn side_value(&self, x: T, y: T) -> T
pub fn side_value(&self, x: T, y: T) -> T
Return the unnormalized signed side measure at (x, y).
Positive is left, negative is right, and zero is on the line.
Mirrors arithmetic::side_value from
arithmetic/infinite_line_functions.hpp:70-93.
Sourcepub fn is_degenerate(&self) -> bool
pub fn is_degenerate(&self) -> bool
Return whether both directional coefficients are zero.
Mirrors arithmetic::is_degenerate from
arithmetic/infinite_line_functions.hpp:99-104.
Sourcepub fn intersection(&self, other: &Self) -> Option<Point2D<T, Cartesian>>
pub fn intersection(&self, other: &Self) -> Option<Point2D<T, Cartesian>>
Calculate the intersection of two non-parallel infinite lines.
Mirrors arithmetic::intersection_point and
assign_intersection_point from
arithmetic/infinite_line_functions.hpp:32-67. None represents
parallel or collinear lines.
Trait Implementations§
Source§impl<T: Clone + CoordinateScalar> Clone for InfiniteLine<T>
impl<T: Clone + CoordinateScalar> Clone for InfiniteLine<T>
Source§fn clone(&self) -> InfiniteLine<T>
fn clone(&self) -> InfiniteLine<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more