pub struct VectorPath {
pub anchors: Vec<Anchor>,
pub closed: bool,
}Fields§
§anchors: Vec<Anchor>§closed: boolImplementations§
Source§impl VectorPath
impl VectorPath
pub fn segment_count(&self) -> usize
pub fn to_bez_path(&self) -> BezPath
pub fn from_bez_path(path: &BezPath) -> Self
Sourcepub fn nearest_segment(&self, point: DVec2) -> Option<(usize, f64, f64)>
pub fn nearest_segment(&self, point: DVec2) -> Option<(usize, f64, f64)>
Return (segment_index, t_param, distance) for the nearest cubic segment.
pub fn hit_test(&self, p: DVec2, tol: f64) -> Option<PathHit>
Sourcepub fn insert_anchor_at(
&mut self,
seg: usize,
t: f64,
) -> Result<(), GeometryError>
pub fn insert_anchor_at( &mut self, seg: usize, t: f64, ) -> Result<(), GeometryError>
De Casteljau split of segment seg at parameter t. New anchor is Smooth.
Sourcepub fn round_corners(&self, radius: f64) -> VectorPath
pub fn round_corners(&self, radius: f64) -> VectorPath
Round every Corner anchor by pulling back radius along both adjacent
edges and joining with a smooth curve (quarter-circle-ish cubic
approximation, k=0.5523 scaled by the pullback distance).
Sourcepub fn apply_edit(&mut self, edit: &AnchorEdit) -> Option<AnchorEdit>
pub fn apply_edit(&mut self, edit: &AnchorEdit) -> Option<AnchorEdit>
Apply an edit and return its exact inverse (None if out of range).
Trait Implementations§
Source§impl Clone for VectorPath
impl Clone for VectorPath
Source§fn clone(&self) -> VectorPath
fn clone(&self) -> VectorPath
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VectorPath
impl Debug for VectorPath
Source§impl Default for VectorPath
impl Default for VectorPath
Source§fn default() -> VectorPath
fn default() -> VectorPath
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for VectorPath
impl<'de> Deserialize<'de> for VectorPath
Source§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
Source§impl PartialEq for VectorPath
impl PartialEq for VectorPath
Source§impl Serialize for VectorPath
impl Serialize for VectorPath
impl StructuralPartialEq for VectorPath
Auto Trait Implementations§
impl Freeze for VectorPath
impl RefUnwindSafe for VectorPath
impl Send for VectorPath
impl Sync for VectorPath
impl Unpin for VectorPath
impl UnsafeUnpin for VectorPath
impl UnwindSafe for VectorPath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more