@@ -7,7 +7,7 @@ To use the Offroad library in your project, add the following to your `Cargo.tom
77
88``` toml
99[dependencies ]
10- offroad = " 0.0.5 "
10+ offroad = " 0.1.0 "
1111```
1212
1313## 2D offsetting for arc polylines/polygons
@@ -16,5 +16,42 @@ offroad = "0.0.5"
1616
1717## Examples
1818
19- Check "examples" directory for more usage examples.
19+ ### Offsetting Arc Lines
20+
21+ ``` rust
22+ use togo :: prelude :: * ;
23+ use offroad :: {offset :: offset_arcline_to_arcline, prelude :: OffsetCfg };
24+
25+ fn main () {
26+ // Configuration for offsetting
27+ let mut cfg = OffsetCfg :: default ();
28+ let mut svg = SVG :: new (300.0 , 300.0 , Some (" /tmp/arcline.svg" ));
29+ cfg . svg = Some (& mut svg );
30+ // Show original arcline in SVG output
31+ cfg . svg_orig = true ;
32+ // Show final offset arclines in SVG output
33+ cfg . svg_final = true ;
34+
35+ let arc0 = arc_circle_parametrization (point (40.0 , 100.0 ), point (140.0 , 200.0 ), 0.0 );
36+ let arc1 = arc_circle_parametrization (point (140.0 , 200.0 ), point (240.0 , 100.0 ), 0.5 );
37+ let arc2 = arc_circle_parametrization (point (240.0 , 100.0 ), point (40.0 , 100.0 ), 1.3 );
38+ let arcs_orig = vec! [arc0 , arc1 , arc2 ];
39+
40+ // External offsetting
41+ let offset_arclines = offset_arcline_to_arcline (& arcs_orig , 15.0 , & mut cfg );
42+
43+ println! (" Input arcline has {} vertices" , arcs_orig . len ());
44+ println! (" Output has {} arclines" , offset_arclines . len ());
45+ for (i , arcline ) in offset_arclines . iter (). enumerate () {
46+ println! (" Arcline {}: {} vertices" , i , arcline . len ());
47+ }
48+
49+ if let Some (svg ) = cfg . svg. as_deref_mut () {
50+ // Write svg to file
51+ svg . write_stroke_width (0.1 );
52+ }
53+ }
54+ ```
55+
56+
2057
0 commit comments