Skip to main content

ClipperOffset

Struct ClipperOffset 

Source
pub struct ClipperOffset { /* private fields */ }
Expand description

Path offset (inflate/shrink) engine. Direct port from ClipperOffset class (clipper.offset.h / clipper.offset.cpp).

Inflates (or shrinks) both open and closed paths using the specified join type and end type. After building the raw offset, a Clipper64 union is used to clean up self-intersections.

Implementations§

Source§

impl ClipperOffset

Source

pub fn new( miter_limit: f64, arc_tolerance: f64, preserve_collinear: bool, reverse_solution: bool, ) -> Self

Create a new ClipperOffset with the given parameters. Direct port from ClipperOffset constructor (clipper.offset.h line 85-91).

Source

pub fn new_default() -> Self

Create a new ClipperOffset with default parameters. miter_limit = 2.0, arc_tolerance = 0.0, preserve_collinear = false, reverse_solution = false.

Source

pub fn error_code(&self) -> i32

Get the error code from the last operation.

Source

pub fn miter_limit(&self) -> f64

Get the miter limit.

Source

pub fn set_miter_limit(&mut self, miter_limit: f64)

Set the miter limit.

Source

pub fn arc_tolerance(&self) -> f64

Get the arc tolerance.

Source

pub fn set_arc_tolerance(&mut self, arc_tolerance: f64)

Set the arc tolerance. Needed for rounded offsets. See offset_trigonometry2.svg.

Source

pub fn preserve_collinear(&self) -> bool

Get the preserve_collinear flag.

Source

pub fn set_preserve_collinear(&mut self, preserve_collinear: bool)

Set the preserve_collinear flag.

Source

pub fn reverse_solution(&self) -> bool

Get the reverse_solution flag.

Source

pub fn set_reverse_solution(&mut self, reverse_solution: bool)

Set the reverse_solution flag.

Source

pub fn set_delta_callback(&mut self, cb: Option<DeltaCallback64>)

Set the delta callback for variable offset. Direct port from ClipperOffset::SetDeltaCallback.

Source

pub fn add_path(&mut self, path: &Path64, jt: JoinType, et: EndType)

Add a single path with the given join type and end type. Direct port from ClipperOffset::AddPath (clipper.offset.cpp line 168-171).

Source

pub fn add_paths(&mut self, paths: &Paths64, jt: JoinType, et: EndType)

Add multiple paths with the given join type and end type. Direct port from ClipperOffset::AddPaths (clipper.offset.cpp line 173-177).

Source

pub fn clear(&mut self)

Clear all groups and normals. Direct port from ClipperOffset::Clear (clipper.offset.h line 98).

Source

pub fn execute(&mut self, delta: f64, paths: &mut Paths64)

Execute the offset operation, storing results in paths. Direct port from ClipperOffset::Execute(double, Paths64&) (clipper.offset.cpp line 636-642).

Source

pub fn execute_tree(&mut self, delta: f64, polytree: &mut PolyTree64)

Execute the offset operation, storing results in a PolyTree64. Direct port from ClipperOffset::Execute(double, PolyTree64&) (clipper.offset.cpp line 645-653).

Source

pub fn execute_with_callback( &mut self, delta_cb: DeltaCallback64, paths: &mut Paths64, )

Execute using a delta callback for variable offset. Direct port from ClipperOffset::Execute(DeltaCallback64, Paths64&) (clipper.offset.cpp line 655-659).

Auto Trait Implementations§

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> 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, 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.