本文整理汇总了C++中clipperlib::Clipper::PreserveCollinear方法的典型用法代码示例。如果您正苦于以下问题:C++ Clipper::PreserveCollinear方法的具体用法?C++ Clipper::PreserveCollinear怎么用?C++ Clipper::PreserveCollinear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clipperlib::Clipper
的用法示例。
在下文中一共展示了Clipper::PreserveCollinear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simplify_polygons
void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::ExPolygons* retval, bool preserve_collinear)
{
PROFILE_FUNC();
if (!preserve_collinear) {
Polygons polygons;
simplify_polygons(subject, &polygons, preserve_collinear);
union_(polygons, retval);
return;
}
// convert into Clipper polygons
ClipperLib::Paths input_subject;
Slic3rMultiPoints_to_ClipperPaths(subject, &input_subject);
ClipperLib::PolyTree polytree;
ClipperLib::Clipper c;
c.PreserveCollinear(true);
c.StrictlySimple(true);
c.AddPaths(input_subject, ClipperLib::ptSubject, true);
c.Execute(ClipperLib::ctUnion, polytree, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
// convert into ExPolygons
PolyTreeToExPolygons(polytree, retval);
}
示例2: simplify_polygons
void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::Polygons* retval, bool preserve_collinear)
{
// convert into Clipper polygons
ClipperLib::Paths input_subject, output;
Slic3rMultiPoints_to_ClipperPaths(subject, &input_subject);
if (preserve_collinear) {
ClipperLib::Clipper c;
c.PreserveCollinear(true);
c.StrictlySimple(true);
c.AddPaths(input_subject, ClipperLib::ptSubject, true);
c.Execute(ClipperLib::ctUnion, output, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
} else {
ClipperLib::SimplifyPolygons(input_subject, output, ClipperLib::pftNonZero);
}
// convert into Slic3r polygons
ClipperPaths_to_Slic3rMultiPoints(output, retval);
}
示例3: simplify_polygons_ex
ExPolygons simplify_polygons_ex(const Polygons &subject, bool preserve_collinear)
{
if (! preserve_collinear)
return union_ex(simplify_polygons(subject, false));
// convert into Clipper polygons
ClipperLib::Paths input_subject = Slic3rMultiPoints_to_ClipperPaths(subject);
ClipperLib::PolyTree polytree;
ClipperLib::Clipper c;
c.PreserveCollinear(true);
c.StrictlySimple(true);
c.AddPaths(input_subject, ClipperLib::ptSubject, true);
c.Execute(ClipperLib::ctUnion, polytree, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
// convert into ExPolygons
return PolyTreeToExPolygons(polytree);
}