@@ -71,6 +71,10 @@ i_overlay = "^4.0"
7171Here's an example of performing a union operation between two polygons:
7272
7373``` rust
74+ use i_overlay :: core :: fill_rule :: FillRule ;
75+ use i_overlay :: core :: overlay_rule :: OverlayRule ;
76+ use i_overlay :: float :: single :: SingleFloatOverlay ;
77+
7478// Define the subject "O"
7579let subj = [
7680 // main contour
@@ -148,6 +152,11 @@ The `overlay` function returns a `Vec<Shapes>`:
148152## Custom Point Type Support
149153` iOverlay ` allows users to define custom point types, as long as they implement the ` FloatPointCompatible ` trait.
150154``` rust
155+ use i_float :: float :: compatible :: FloatPointCompatible ;
156+ use i_overlay :: core :: fill_rule :: FillRule ;
157+ use i_overlay :: core :: overlay_rule :: OverlayRule ;
158+ use i_overlay :: float :: single :: SingleFloatOverlay ;
159+
151160#[derive(Clone , Copy , Debug )]
152161struct CustomPoint {
153162 x : f32 ,
@@ -195,6 +204,10 @@ println!("result: {:?}", result);
195204<img src =" readme/example_slice.svg " alt =" Slicing Example " style =" width :400px ;" >
196205
197206``` rust
207+ use i_overlay :: core :: fill_rule :: FillRule ;
208+ use i_overlay :: float :: single :: SingleFloatOverlay ;
209+ use i_overlay :: float :: slice :: FloatSlice ;
210+
198211let polygon = [
199212 [1.0 , 1.0 ],
200213 [1.0 , 4.0 ],
@@ -219,6 +232,11 @@ println!("result: {:?}", result);
219232<img src =" readme/example_clip.svg " alt =" Clip Example " style =" width :400px ;" >
220233
221234``` rust
235+ use i_overlay :: core :: fill_rule :: FillRule ;
236+ use i_overlay :: float :: clip :: FloatClip ;
237+ use i_overlay :: float :: single :: SingleFloatOverlay ;
238+ use i_overlay :: string :: clip :: ClipRule ;
239+
222240let polygon = [
223241 [1.0 , 1.0 ],
224242 [1.0 , 4.0 ],
@@ -243,10 +261,13 @@ println!("result: {:?}", result);
243261
244262## Buffering
245263
246- ### Offseting a Path
264+ ### Offsetting a Path
247265<img src =" readme/example_offseting_path.svg " alt =" Path Example " style =" width :400px ;" >
248266
249267``` rust
268+ use i_overlay :: mesh :: stroke :: offset :: StrokeOffset ;
269+ use i_overlay :: mesh :: style :: {LineCap , LineJoin , StrokeStyle };
270+
250271let path = [
251272 [ 2.0 , 1.0 ],
252273 [ 5.0 , 1.0 ],
@@ -269,10 +290,13 @@ println!("result: {:?}", shapes);
269290```
270291  ;
271292
272- ### Offseting a Polygon
293+ ### Offsetting a Polygon
273294<img src =" readme/example_offseting_polygon.svg " alt =" Path Example " style =" width :400px ;" >
274295
275296``` rust
297+ use i_overlay :: mesh :: outline :: offset :: OutlineOffset ;
298+ use i_overlay :: mesh :: style :: {LineJoin , OutlineStyle };
299+
276300let shape = vec! [
277301 vec! [
278302 [2.0 , 1.0 ],
@@ -314,7 +338,7 @@ println!("shapes: {:?}", &shapes);
314338 - No self-intersections.
315339 - Outer boundaries are ** counterclockwise** , holes are ** clockwise** —unless ` main_direction ` is set.
316340
317- If polygon validity cannot be guaranteed, it is recommended to apply the [ simplify_shape] ( https://github.com/iShape-Rust/iOverlay/blob/main/src/float/simplify.rs ) operation before offsetting.
341+ If polygon validity cannot be guaranteed, it is recommended to apply the [ simplify_shape] ( https://github.com/iShape-Rust/iOverlay/blob/main/iOverlay/ src/float/simplify.rs ) operation before offsetting.
318342 [ More information] ( https://ishape-rust.github.io/iShape-js/overlay/contours/contours.html ) on contour orientation.
319343
320344- Using ` LineJoin::Bevel ` with a large offset may produce visual artifacts.
@@ -327,13 +351,13 @@ println!("shapes: {:?}", &shapes);
327351
328352  ;
329353### LineJoin
330- | Bevel | Mitter | Round |
354+ | Bevel | Miter | Round |
331355| -------| --------| -------|
332- | <img src =" readme/line_join_bevel.svg " alt =" Bevel " style =" width :100px ;" > | <img src =" readme/line_join_mitter.svg " alt =" Mitter " style =" width :100px ;" > | <img src =" readme/line_join_round.svg " alt =" Round " style =" width :100px ;" > |
356+ | <img src =" readme/line_join_bevel.svg " alt =" Bevel " style =" width :100px ;" > | <img src =" readme/line_join_mitter.svg " alt =" Miter " style =" width :100px ;" > | <img src =" readme/line_join_round.svg " alt =" Round " style =" width :100px ;" > |
333357
334358  ;
335359
336- # FAQ
360+ ## FAQ
337361### 1. When should I use ` FloatOverlay ` , ` SingleFloatOverlay ` , or ` FloatOverlayGraph ` ?
338362
339363- Use ** ` FloatOverlay ` ** when you perform ** repeated overlay operations** :
@@ -430,7 +454,7 @@ assert_eq!(result.len(), 2);
430454
431455---
432456
433- # Versioning Policy
457+ ## Versioning Policy
434458
435459This crate follows a pragmatic versioning approach:
436460
0 commit comments