Delphifunction SimplifyPath(const path: TPath64; epsilon: double;
isClosedPath: Boolean = true): TPath64; overload;
Delphifunction SimplifyPaths(const paths: TPaths64;
epsilon: double; isClosedPath: Boolean = true): TPaths64; overload;
Delphifunction SimplifyPath(const path: TPathD;
epsilon: double; isClosedPath: Boolean = true): TPathD; overload;
Delphifunction SimplifyPaths(const paths: TPathsD;
epsilon: double; isClosedPath: Boolean = true): TPathsD; overload;
C++inline Path<T> SimplifyPath(const Path<T>& path, double epsilon,
bool isClosedPath = true);
C++inline Paths<T> SimplifyPaths(const Paths<T>& path, double epsilon,
bool isClosedPath = true);
C# public static Path64 SimplifyPath(Path64 path, double epsilon, bool isClosedPath = true);
C# public static Paths64 SimplifyPaths(Paths64 path, double epsilon, bool isClosedPath = true);
C# public static PathD SimplifyPath(PathD path, double epsilon, bool isClosedPath = true);
C# public static PathsD SimplifyPaths(PathsD path, double epsilon, bool isClosedPath = true);
This function removes vertices that are less than the specified epsilon distance from an imaginary line that passes through its 2 adjacent vertices. Logically, smaller epsilon values will be less aggressive in removing vertices than larger epsilon values.
This function is strongly recommended before offsetting (ie before inflating/shrinking) when paths may contain redundant segments. (See notes on redundant segments here.) And removing redundant segments is especially important when offsetting paths that have themselves been offset.
#include "../../Clipper2Lib/clipper.h" #include "../../Utils/clipper.svg.h" #include "../../Utils/clipper.svg.utils.h" ... using namespace Clipper2Lib; int main() { SvgReader svg_reader; svg_reader.LoadFromFile("./rabbit.svg"); PathsD p = svg_reader.GetPaths(), solution; while (p.size()) { //copy each iteration of 'p' into solution until 'p' is no more solution.reserve(solution.size() + p.size()); copy(p.begin(), p.end(), back_inserter(solution)); p = InflatePaths(p, -2.5, JoinType::Round, EndType::Polygon); p = SimplifyPaths(p, 0.025); } SvgAddSolution(svg, solution, false); SvgSaveToFile(svg, "rabbit_offset.svg", 338, 540, 0); }
Copyright © 2010-2024 Angus Johnson - Clipper2 1.5.0 - Help file built on 24 Jan 2025