MCPcopy Create free account
hub / github.com/esengine/esengine / intersection

Method intersection

packages/fairygui/src/utils/MathTypes.ts:125–137  ·  view source on GitHub ↗
(other: IRectangle, out?: Rectangle)

Source from the content-addressed store, hash-verified

123 }
124
125 public intersection(other: IRectangle, out?: Rectangle): Rectangle | null {
126 const x = Math.max(this.x, other.x);
127 const y = Math.max(this.y, other.y);
128 const right = Math.min(this.right, other.x + other.width);
129 const bottom = Math.min(this.bottom, other.y + other.height);
130
131 if (right <= x || bottom <= y) {
132 return null;
133 }
134
135 out = out || new Rectangle();
136 return out.set(x, y, right - x, bottom - y);
137 }
138
139 public union(other: IRectangle, out?: Rectangle): Rectangle {
140 const x = Math.min(this.x, other.x);

Callers

nothing calls this directly

Calls 3

setMethod · 0.65
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected