difference

Function difference 

Source
pub fn difference<P: PointScaler>(
    subject: impl Into<Paths<P>>,
    clip: impl Into<Paths<P>>,
    fill_rule: FillRule,
) -> Result<Paths<P>, ClipperError>
Expand description

This function differences closed subject paths from clip paths.

ยงExamples

use clipper2::*;

let path_a: Paths = vec![(0.2, 0.2), (6.0, 0.2), (6.0, 6.0), (0.2, 6.0)].into();
let path_b: Paths = vec![(5.0, 5.0), (8.0, 5.0), (8.0, 8.0), (5.0, 8.0)].into();

let output: Vec<Vec<(f64, f64)>> = difference(path_a, path_b, FillRule::default())
    .expect("Failed to run boolean operation").into();

dbg!(output);

Image displaying the result of the difference example

For more details see the original difference docs.