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.
Round
About center; an arc’s part of it from the angle start,
counter-clockwise by sweep (clockwise if negative).
Implementations§
Source§impl Plain
impl Plain
Sourcepub fn of(sketch: &Sketch, curve: CurveId, infinite: bool) -> Option<Plain>
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.
Sourcepub fn arc(s: P2, e: P2, sweep: f64) -> Option<Plain>
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.
Sourcepub fn param(&self, q: P2) -> f64
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.
Sourcepub fn nearest(&self, q: P2) -> f64
pub fn nearest(&self, q: P2) -> f64
Where along it — in [0, 1], as Plain::param — it comes
nearest q.
Sourcepub fn at(&self, t: f64) -> P2
pub fn at(&self, t: f64) -> P2
The point t along it (see Plain::param).
Sourcepub fn tangent(&self, t: f64) -> P2
pub fn tangent(&self, t: f64) -> P2
Its unit direction of travel at t along it (see Plain::param).
Sourcepub fn part(&self, t0: f64, t1: f64) -> Plain
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.