Optimized Vector[2D].containedWithin and Vector.equals slightly.

This commit is contained in:
TomyLobo 2012-01-08 16:27:15 +01:00
parent 99b0345ca6
commit 4890c1ef9c
2 changed files with 6 additions and 6 deletions

View File

@ -517,9 +517,9 @@ public class Vector {
* @return * @return
*/ */
public boolean containedWithin(Vector min, Vector max) { public boolean containedWithin(Vector min, Vector max) {
return x >= min.getX() && x <= max.getX() return x >= min.x && x <= max.x
&& y >= min.getY() && y <= max.getY() && y >= min.y && y <= max.y
&& z >= min.getZ() && z <= max.getZ(); && z >= min.z && z <= max.z;
} }
/** /**
@ -679,7 +679,7 @@ public class Vector {
} }
Vector other = (Vector) obj; Vector other = (Vector) obj;
return other.getX() == this.x && other.getY() == this.y && other.getZ() == this.z; return other.x == this.x && other.y == this.y && other.z == this.z;
} }
/** /**

View File

@ -456,8 +456,8 @@ public class Vector2D {
* @return * @return
*/ */
public boolean containedWithin(Vector2D min, Vector2D max) { public boolean containedWithin(Vector2D min, Vector2D max) {
return x >= min.getX() && x <= max.getX() return x >= min.x && x <= max.x
&& z >= min.getZ() && z <= max.getZ(); && z >= min.z && z <= max.z;
} }
/** /**