MCPcopy Create free account
hub / github.com/DFHack/dfhack / intersect

Function intersect

library/include/Types.h:101–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 typedef std::pair<df::coord2d, df::coord2d> rect2d;
100
101 inline rect2d intersect(rect2d a, rect2d b) {
102 df::coord2d g1 = a.first, g2 = a.second;
103 df::coord2d c1 = b.first, c2 = b.second;
104 df::coord2d rc1 = df::coord2d(std::max(g1.x, c1.x), std::max(g1.y, c1.y));
105 df::coord2d rc2 = df::coord2d(std::min(g2.x, c2.x), std::min(g2.y, c2.y));
106 return rect2d(rc1, rc2);
107 }
108
109 inline rect2d mkrect_xy(int x1, int y1, int x2, int y2) {
110 return rect2d(df::coord2d(x1, y1), df::coord2d(x2, y2));

Callers 2

viewportFunction · 0.85
Screen.hFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected