MCPcopy Create free account
hub / github.com/comaps/comaps / ClipSplineByRect

Function ClipSplineByRect

libs/geometry/clipping.cpp:198–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198std::vector<m2::SharedSpline> ClipSplineByRect(m2::RectD const & rect, m2::SharedSpline const & spline)
199{
200 switch (GetRectCase(rect, spline->GetPath()))
201 {
202 case RectCase::Inside: return {spline};
203 case RectCase::Outside: return {};
204 case RectCase::Intersect:
205 {
206 std::vector<m2::SharedSpline> res;
207 res.reserve(2); // keep previous behavior, but not sure that its actually needed
208 ClipPathByRectImpl(rect, spline->GetPath(), base::MakeBackInsertFunctor(res));
209 return res;
210 }
211 }
212 CHECK(false, ("Unreachable"));
213 return {};
214}
215
216void ClipPathByRect(m2::RectD const & rect, std::vector<m2::PointD> && path,
217 std::function<void(m2::SharedSpline &&)> const & fn)

Callers 4

UNIT_TESTFunction · 0.85
CacheUserLinesFunction · 0.85
ProcessLineStyleMethod · 0.85
ProcessLineRulesMethod · 0.85

Calls 5

GetRectCaseFunction · 0.85
ClipPathByRectImplFunction · 0.85
MakeBackInsertFunctorFunction · 0.85
GetPathMethod · 0.45
reserveMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68