svg_path/cut

Cutting helpers for path geometry.

Cutters are only used to find intersection parameters on the subject; only subject pieces are returned.

Values

pub fn path(
  subject subject: svg_path.Path,
  by cutter: svg_path.Path,
) -> Result(svg_path.Path, svg_path.Error)

Cut a subject path by a cutter path.

The returned path contains only pieces of the subject path, in subject traversal order. The cutter path is only used to find cut points. All cut points for each subject subpath are gathered before cutting, so the result is independent of cutter subpath order.

pub fn path_with(
  subject subject: svg_path.Path,
  by cutter: svg_path.Path,
  options options: intersections.IntersectionOptions,
) -> Result(svg_path.Path, svg_path.Error)

Cut a subject path by a cutter path using explicit intersection options.

pub fn subpath(
  subject subject: svg_path.Subpath,
  by cutter: svg_path.Subpath,
) -> Result(List(svg_path.Subpath), svg_path.Error)

Cut a subject subpath by a cutter subpath.

The returned pieces follow the subject’s traversal order. The cutter is not returned. If there are no usable cut points, the unchanged subject is returned in a singleton list.

For open subjects, intersections at the very start or very end are ignored because they do not cut the subject. For closed subjects, one cut point opens the whole loop at that point; two or more cut points return the open pieces between adjacent cut points.

pub fn subpath_with(
  subject subject: svg_path.Subpath,
  by cutter: svg_path.Subpath,
  options options: intersections.IntersectionOptions,
) -> Result(List(svg_path.Subpath), svg_path.Error)

Cut a subject subpath by a cutter subpath using explicit intersection options.

Search Document