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
impl ClipperOffset
Sourcepub fn new(
miter_limit: f64,
arc_tolerance: f64,
preserve_collinear: bool,
reverse_solution: bool,
) -> Self
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).
Sourcepub fn new_default() -> Self
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.
Sourcepub fn error_code(&self) -> i32
pub fn error_code(&self) -> i32
Get the error code from the last operation.
Sourcepub fn miter_limit(&self) -> f64
pub fn miter_limit(&self) -> f64
Get the miter limit.
Sourcepub fn set_miter_limit(&mut self, miter_limit: f64)
pub fn set_miter_limit(&mut self, miter_limit: f64)
Set the miter limit.
Sourcepub fn arc_tolerance(&self) -> f64
pub fn arc_tolerance(&self) -> f64
Get the arc tolerance.
Sourcepub fn set_arc_tolerance(&mut self, arc_tolerance: f64)
pub fn set_arc_tolerance(&mut self, arc_tolerance: f64)
Set the arc tolerance. Needed for rounded offsets. See offset_trigonometry2.svg.
Sourcepub fn preserve_collinear(&self) -> bool
pub fn preserve_collinear(&self) -> bool
Get the preserve_collinear flag.
Sourcepub fn set_preserve_collinear(&mut self, preserve_collinear: bool)
pub fn set_preserve_collinear(&mut self, preserve_collinear: bool)
Set the preserve_collinear flag.
Sourcepub fn reverse_solution(&self) -> bool
pub fn reverse_solution(&self) -> bool
Get the reverse_solution flag.
Sourcepub fn set_reverse_solution(&mut self, reverse_solution: bool)
pub fn set_reverse_solution(&mut self, reverse_solution: bool)
Set the reverse_solution flag.
Sourcepub fn set_delta_callback(&mut self, cb: Option<DeltaCallback64>)
pub fn set_delta_callback(&mut self, cb: Option<DeltaCallback64>)
Set the delta callback for variable offset. Direct port from ClipperOffset::SetDeltaCallback.
Sourcepub fn add_path(&mut self, path: &Path64, jt: JoinType, et: EndType)
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).
Sourcepub fn add_paths(&mut self, paths: &Paths64, jt: JoinType, et: EndType)
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).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear all groups and normals. Direct port from ClipperOffset::Clear (clipper.offset.h line 98).
Sourcepub fn execute(&mut self, delta: f64, paths: &mut Paths64)
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).
Sourcepub fn execute_tree(&mut self, delta: f64, polytree: &mut PolyTree64)
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).
Sourcepub fn execute_with_callback(
&mut self,
delta_cb: DeltaCallback64,
paths: &mut Paths64,
)
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).