Skip to content
Seth Hillbrand edited this page Oct 29, 2026 · 2 revisions

Home › clipper.h › Union

Union

Paths64 Union(const Paths64& subjects, FillRule fillrule);
Paths64 Union(const Paths64& subjects, const Paths64& clips, FillRule fillrule);
PathsD Union(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimalPrec);

This function 'unions' closed subject paths, with and without clip paths. However, with more complex clipping operations (eg when clipping open paths), you'll need to use the Clipper64 or ClipperD classes directly.

When using floating point types, the precision parameter indicated the desired coordinate precision (up to 8 decimal places).

Example:

Paths64 subject, clip, solution;
subject.push_back(MakePath({100, 50, 10, 79, 65, 2, 65, 98, 10, 21}));
clip.push_back(MakePath({98, 63, 4, 68, 77, 8, 52, 100, 19, 12}));
solution = Union(subject, clip, FillRule::NonZero);  
//draw solution

  

See Also

Overview, Clipper64, ClipperD, ClipType, FillRule

Clone this wiki locally