clipper2_sys/clipperd/
paths.rs1use crate::cxx_bridge::clipper2_sys_cxx::PathsBlobD;
2use crate::paths_blob::{pathsd_from_blob, PathsBlobDIter};
3use crate::PathD;
4
5define_lazy_paths! {
6 LazyPathsD,
10 blob = PathsBlobD,
11 paths = PathsD,
12 path = PathD,
13 iter = PathsBlobDIter,
14 from_blob = pathsd_from_blob,
15}
16
17#[derive(Clone, Debug, Default)]
21pub struct PathsD(pub(crate) Vec<PathD>);
22
23impl_paths_collection!(float, PathsD, PathD);
24
25#[cfg(test)]
26mod tests {
27 use crate::{PathD, PathsD, PointD};
28
29 #[test]
30 fn paths_d_append_and_translate() {
31 let mut ps = PathsD::default();
32 ps.add_path(PathD::new(vec![PointD::new(0.0, 0.0), PointD::new(1.0, 0.0)]));
33 let u = ps.translate(1.0, 2.0);
34 assert!((u.path(0).get_point(0).x - 1.0).abs() < 1e-9);
35 }
36}