[−][src]Struct arcs::primitives::Line
A line connecting Line::start
to Line::end
.
Fields
start: Point2D<f64, S>
The Line
's starting point.
end: Point2D<f64, S>
The Line
's ending point.
Implementations
impl<S> Line<S>
[src]
pub const fn new(start: Point2D<f64, S>, end: Point2D<f64, S>) -> Line<S>
[src]
Create a new Line
.
pub fn displacement(&self) -> Vector2D<f64, S>
[src]
The displacement vector from Line::start
to Line::end
.
pub fn direction(&self) -> Vector2D<f64, S>
[src]
The [Line::displacement()
], normalised to a unit vector.
pub fn length(self) -> f64
[src]
The Line
's length.
pub fn perpendicular_distance_to(self, point: Point2D<f64, S>) -> Length<f64, S>
[src]
How close would the [Point2D
] get if this line were extended
forever?
See also Distance from a point to a line on Wikipedia.
Trait Implementations
impl<Space> AffineTransformable for Line<Space>
[src]
fn transform(&mut self, transform: Transform2D<f64, UnknownUnit, UnknownUnit>)
[src]
fn transformed(
&self,
transform: Transform2D<f64, UnknownUnit, UnknownUnit>
) -> Self where
Self: Clone,
[src]
&self,
transform: Transform2D<f64, UnknownUnit, UnknownUnit>
) -> Self where
Self: Clone,
impl<Space> Approximate<Space> for Line<Space>
[src]
type Iter = Chain<Once<Point2D<f64, Space>>, Once<Point2D<f64, Space>>>
An iterator over the approximated vertices.
fn approximate(
&self,
_tolerance: f64
) -> <Line<Space> as Approximate<Space>>::Iter
[src]
&self,
_tolerance: f64
) -> <Line<Space> as Approximate<Space>>::Iter
impl<S> Bounded<S> for Line<S>
[src]
fn bounding_box(&self) -> BoundingBox<S>
[src]
impl<S> Clone for Line<S>
[src]
impl<Space> ClosestPoint<Space> for Line<Space>
[src]
fn closest_point(&self, target: Point2D<f64, Space>) -> Closest<Space>
[src]
impl<S> Copy for Line<S>
[src]
impl<S> Debug for Line<S> where
S: Debug,
[src]
S: Debug,
impl<S> Default for Line<S> where
S: Default,
[src]
S: Default,
impl<Space> Length for Line<Space>
[src]
fn length(&self) -> f64
[src]
Calculates the length of the line.
let line = Line::new(Point::zero(), Point::new(5.0, 0.0)); assert_eq!(line.length(), 5.0);
impl<S> PartialEq<Line<S>> for Line<S> where
S: PartialEq<S>,
[src]
S: PartialEq<S>,
impl<S> StructuralPartialEq for Line<S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for Line<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for Line<S> where
S: Send,
S: Send,
impl<S> Sync for Line<S> where
S: Sync,
S: Sync,
impl<S> Unpin for Line<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for Line<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> RoundFrom<T> for T
[src]
fn round_from(x: T) -> T
[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
[src]
U: RoundFrom<T>,
fn round_into(self) -> U
[src]
impl<S> Scale for S where
S: ScaleNonUniform,
[src]
S: ScaleNonUniform,
fn scale(&mut self, scale_factor: f64)
[src]
fn scaled(&self, scale_factor: f64) -> Self where
Self: Clone,
[src]
Self: Clone,
impl<A> ScaleNonUniform for A where
A: AffineTransformable,
[src]
A: AffineTransformable,
fn scale_non_uniform(&mut self, factor_x: f64, factor_y: f64)
[src]
fn scaled_non_uniform(&self, factor_x: f64, factor_y: f64) -> Self where
Self: Clone,
[src]
Self: Clone,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<Space, A> Translate<Space> for A where
A: AffineTransformable,
[src]
A: AffineTransformable,
fn translate(&mut self, displacement: Vector2D<f64, Space>)
[src]
fn translated(&self, displacement: Vector2D<f64, Space>) -> Self where
Self: Clone,
[src]
Self: Clone,
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,