mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-11 07:47:47 +00:00
Add intersects method to Rectangle4i
Added compare methods to MathHelper
This commit is contained in:
1 parent
699221214c
commit
8a777b265e
2 files changed
+16
No files matched your search
@@ -165,4 +165,14 @@ public class MathHelper
|
||||
{
|
||||
return (int) (d < 0 ? Math.floor(d) : Math.ceil(d));
|
||||
}
|
||||
|
||||
public static int compare(int a, int b)
|
||||
{
|
||||
return a == b ? 0 : a < b ? -1 : 1;
|
||||
}
|
||||
|
||||
public static int compare(double a, double b)
|
||||
{
|
||||
return a == b ? 0 : a < b ? -1 : 1;
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,10 @@ public class Rectangle4i
|
||||
{
|
||||
return x <= px && px < x+w && y <= py && py < y+h;
|
||||
}
|
||||
|
||||
public boolean intersects(Rectangle4i r)
|
||||
{
|
||||
return x <= r.x+r.w && r.x <= x+w &&
|
||||
y <= r.y+r.h && r.y <= y+h;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user