MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / intersection

Method intersection

src/main/java/field/utility/Rect.java:71–80  ·  view source on GitHub ↗
(Rect a, Rect b)

Source from the content-addressed store, hash-verified

69 }
70
71 static public Rect intersection(Rect a, Rect b)
72 {
73 float minx = (float) Math.min(a.x+a.w, b.x+b.w);
74 float miny = (float) Math.min(a.y+a.h, b.y+b.h);
75
76 float maxx= (float) Math.max(a.x, b.x);
77 float maxy = (float) Math.max(a.y, b.y);
78
79 return new Rect(maxx, maxy, Math.max(0, minx-maxx), Math.max(0, miny-maxy));
80 }
81
82 public Rect translate(Vec2 by)
83 {

Callers

nothing calls this directly

Calls 2

minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected