Enum kurbo::PathSeg [−][src]
Expand description
A segment of a Bézier path.
Variants
Line(Line)
Tuple Fields
0: Line
A line segment.
Quad(QuadBez)
Tuple Fields
0: QuadBez
A quadratic bezier segment.
Cubic(CubicBez)
Tuple Fields
0: CubicBez
A cubic bezier segment.
Implementations
Returns a new PathSeg
describing the same path as self
, but with
the points reversed.
Compute intersections against a line.
Returns a vector of the intersections. For each intersection,
the t
value of the segment and line are given.
Note: This test is designed to be inclusive of points near the endpoints
of the segment. This is so that testing a line against multiple
contiguous segments of a path will be guaranteed to catch at least one
of them. In such cases, use higher level logic to coalesce the hits
(the t
value may be slightly outside the range of 0..1).
Examples
let seg = PathSeg::Line(Line::new((0.0, 0.0), (2.0, 0.0)));
let line = Line::new((1.0, 2.0), (1.0, -2.0));
let intersection = seg.intersect_line(line);
assert_eq!(intersection.len(), 1);
let intersection = intersection[0];
assert_eq!(intersection.segment_t, 0.5);
assert_eq!(intersection.line_t, 0.5);
let point = seg.eval(intersection.segment_t);
assert_eq!(point, Point::new(1.0, 0.0));
Minimum distance between two PathSegs
Returns a tuple of the distance, the path time t1
of the closest point
on the first PathSeg, and the path time t2
of the closest point on the
second PathSeg.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Get a subsegment of the curve for the given parameter range.
Compute the signed area under the curve. Read more
Return parameter ranges, each of which is monotonic within the range.
The smallest rectangle that encloses the curve in the range (0..1).
The area under the curve.
We could just return 0, but this seems more useful.
type PathElementsIter = PathSegIter
type PathElementsIter = PathSegIter
The iterator returned by the path_elements
method. Read more
fn path_elements(&self, _tolerance: f64) -> PathSegIterⓘNotable traits for PathSegIterimpl Iterator for PathSegIter type Item = PathEl;
fn path_elements(&self, _tolerance: f64) -> PathSegIterⓘNotable traits for PathSegIterimpl Iterator for PathSegIter type Item = PathEl;
impl Iterator for PathSegIter type Item = PathEl;
The smallest rectangle that encloses the shape.
If the shape is a rounded rectangle, make it available.
Auto Trait Implementations
impl RefUnwindSafe for PathSeg
impl UnwindSafe for PathSeg
Blanket Implementations
Mutably borrows from an owned value. Read more