code: public CollisionResult computeCollision(Transformable transformable, CollisionCategory category)
      {
          // Distance calculation
          final double sh = transformable.getOldX() + category.getOffsetX();
          final double sv = transformable.getOldY() + category.getOffsetY();
  
          final double dh = transformable.getX() + category.getOffsetX() - sh;
          final double dv = transformable.getY() + category.getOffsetY() - sv;
  
          final double nh = Math.abs(dh);
          final double nv = Math.abs(dv);
  
          final int max = (int) Math.ceil(Math.max(nh, nv));
          final double sx;
          final double sy;
  
          if (Double.compare(nh, 1.0) >= 0 || Double.compare(nv, 1.0) >= 0)
          {
              sx = dh / max;
              sy = dv / max;
          }
          else
          {
              sx = dh;
              sy = dv;
          }
  
          return computeCollision(category, sh, sv, sx, sy, max);
      }
docs: Search first tile hit by the transformable that contains collision, applying a ray tracing from its old location
  to its current. This way, the transformable can not pass through a collidable tile.
  
  @param transformable The transformable reference.
  @param category The collisions category to search in.
  @return The collision result, <code>null</code> if nothing found.