Esempio n. 1
0
 @Override
 public AABBOld reflect() {
   // We need to manually do this since AABB breaks if v00 is to the right
   // of v11, as we make algorithmic simplifications on the assumption
   // that v00 is always to the left of v11.
   return new AABBOld(Vec2.immutable(-v11.x(), v00.y()), Vec2.immutable(-v00.x(), v11.y()));
 }
Esempio n. 2
0
 @Override
 protected Vec2[] getVertices() {
   // throw new UnsupportedOperationException("AABB should have no need "
   //        + "for getVertices()!");
   return new Vec2[] {
     v00,
     Vec2.immutable(v11.x(), v00.y()), // v10
     v11,
     Vec2.immutable(v00.x(), v11.y()) // v01
   };
 }
Esempio n. 3
0
 /**
  * Creates a new AABB. It is implicitly trusted that the given values for {@code width} and {@code
  * height} are non-negative.
  *
  * @param x The x-coordinate of the AABB's bottom-left vertex.
  * @param y The y-coordinate of the AABB's bottom-left vertex.
  * @param width The AABB's width.
  * @param height The AABB's height.
  */
 public AABBOld(float x, float y, float width, float height) {
   v00 = Vec2.immutable(x, y);
   v11 = Vec2.immutable(x + width, y + height);
 }