MCPcopy Create free account
hub / github.com/axmolengine/axmol / AddNewIntersectNode

Method AddNewIntersectNode

3rdparty/clipper2/src/clipper.engine.cpp:2356–2388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2354 }
2355
2356 void ClipperBase::AddNewIntersectNode(Active& e1, Active& e2, int64_t top_y)
2357 {
2358 Point64 ip;
2359 if (!GetLineIntersectPt(e1.bot, e1.top, e2.bot, e2.top, ip))
2360 ip = Point64(e1.curr_x, top_y); //parallel edges
2361
2362 //rounding errors can occasionally place the calculated intersection
2363 //point either below or above the scanbeam, so check and correct ...
2364 if (ip.y > bot_y_ || ip.y < top_y)
2365 {
2366 double abs_dx1 = std::fabs(e1.dx);
2367 double abs_dx2 = std::fabs(e2.dx);
2368 if (abs_dx1 > 100 && abs_dx2 > 100)
2369 {
2370 if (abs_dx1 > abs_dx2)
2371 ip = GetClosestPointOnSegment(ip, e1.bot, e1.top);
2372 else
2373 ip = GetClosestPointOnSegment(ip, e2.bot, e2.top);
2374 }
2375 else if (abs_dx1 > 100)
2376 ip = GetClosestPointOnSegment(ip, e1.bot, e1.top);
2377 else if (abs_dx2 > 100)
2378 ip = GetClosestPointOnSegment(ip, e2.bot, e2.top);
2379 else
2380 {
2381 if (ip.y < top_y) ip.y = top_y;
2382 else ip.y = bot_y_;
2383 if (abs_dx1 < abs_dx2) ip.x = TopX(e1, ip.y);
2384 else ip.x = TopX(e2, ip.y);
2385 }
2386 }
2387 intersect_nodes_.emplace_back(&e1, &e2, ip);
2388 }
2389
2390 bool ClipperBase::BuildIntersectList(const int64_t top_y)
2391 {

Callers

nothing calls this directly

Calls 6

GetLineIntersectPtFunction · 0.85
Point64Class · 0.85
fabsFunction · 0.85
GetClosestPointOnSegmentFunction · 0.85
TopXFunction · 0.85
emplace_backMethod · 0.45

Tested by

no test coverage detected