Skip to main content

Plain

Enum Plain 

Source
pub enum Plain {
    Line {
        a: P2,
        b: P2,
        infinite: bool,
    },
    Round {
        center: P2,
        radius: f64,
        span: Option<(f64, f64)>,
    },
}
Expand description

A line, circle or arc in plain numbers: what intersections are found on, and where along it a point is.

Variants§

§

Line

From a to b, or — infinite — the whole line through them.

Fields

§a: P2
§b: P2
§infinite: bool
§

Round

About center; an arc’s part of it from the angle start, counter-clockwise by sweep (clockwise if negative).

Fields

§center: P2
§radius: f64
§span: Option<(f64, f64)>

Implementations§

Source§

impl Plain

Source

pub fn of(sketch: &Sketch, curve: CurveId, infinite: bool) -> Option<Plain>

curve of sketch as drawn, infinite if a line; none for a spline or a text, or an arc too straight to have a center.

Source

pub fn arc(s: P2, e: P2, sweep: f64) -> Option<Plain>

The arc from s to e turning by sweep; none if too straight to have a center.

Source

pub fn full(self) -> Plain

The whole line or circle it lies on.

Source

pub fn closed(&self) -> bool

Whether it is closed: a circle.

Source

pub fn param(&self, q: P2) -> f64

Where q, a point of its full line or circle, is along it: from 0 at its start to 1 at its end — a circle’s start the angle 0, turning counter-clockwise. Beyond [0, 1] for a point of the line or circle outside the line’s or arc’s own part of it.

Source

pub fn nearest(&self, q: P2) -> f64

Where along it — in [0, 1], as Plain::param — it comes nearest q.

Source

pub fn at(&self, t: f64) -> P2

The point t along it (see Plain::param).

Source

pub fn tangent(&self, t: f64) -> P2

Its unit direction of travel at t along it (see Plain::param).

Source

pub fn part(&self, t0: f64, t1: f64) -> Plain

Its part from t0 to t1 along it (see Plain::param): of a line, the segment; of an arc or circle, the arc.

Source

pub fn polyline(&self, t0: f64, t1: f64) -> Vec<P2> ⓘ

The polyline from t0 to t1 along it (see Plain::param).

Source

pub fn holds(&self, q: P2) -> bool

Whether q, a point of its full line or circle, lies on it.

Source

pub fn crossings(&self, other: &Plain, touching: bool) -> Vec<P2> ⓘ

Where the full lines and circles of self and other cross, kept where both actually run. Curves touching — tangent by constraint — meet at one point, where the two crossings close to coincide are taken as one.

Trait Implementations§

Source§

impl Clone for Plain

Source§

fn clone(&self) -> Plain

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Plain

Source§

impl Debug for Plain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Plain

Source§

fn eq(&self, other: &Plain) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Plain

Auto Trait Implementations§

§

impl Freeze for Plain

§

impl RefUnwindSafe for Plain

§

impl Send for Plain

§

impl Sync for Plain

§

impl Unpin for Plain

§

impl UnsafeUnpin for Plain

§

impl UnwindSafe for Plain

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.