nus-yam/ex-repair huggingface dataset:
Program: 96916
Project: 96916
Buggy source:
@Override public void init(){
  Logger.log("String_Node_Str" + getPlatform());
  if (getPlatform() == Platform.MACOSX) {
    Logger.log("String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  Logger.log("String_Node_Str");
  NativesLoader.loadLWJGL();
  Logger.log("String_Node_Str" + Sys.getVersion() + "String_Node_Str");
  if (glfwInit() != GL_TRUE)   throw new SilenceException("String_Node_Str");
  graphics=new GraphicsEngine();
  audio=new AudioEngine();
  collision=new CollisionEngine();
  input=new InputEngine();
  graphics.init();
  audio.init();
  collision.init();
  input.init();
  Logger.log("String_Node_Str" + getVersion() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void init(){
  Logger.log("String_Node_Str" + getPlatform());
  if (getPlatform() == Platform.MACOSX) {
    Logger.log("String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  Logger.log("String_Node_Str");
  NativesLoader.loadLWJGL();
  Logger.log("String_Node_Str" + Sys.getVersion() + "String_Node_Str");
  if (!GLFW3.init())   throw new SilenceException("String_Node_Str");
  graphics=new GraphicsEngine();
  audio=new AudioEngine();
  collision=new CollisionEngine();
  input=new InputEngine();
  graphics.init();
  audio.init();
  collision.init();
  input.init();
  Logger.log("String_Node_Str" + getVersion() + "String_Node_Str");
}
Program: 96917
Project: 96917
Buggy source:
@Override public void dispose(){
  audio.dispose();
  collision.dispose();
  input.dispose();
  graphics.dispose();
  Logger.log("String_Node_Str");
  glfwTerminate();
  Logger.log("String_Node_Str" + getVersion() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void dispose(){
  audio.dispose();
  collision.dispose();
  input.dispose();
  graphics.dispose();
  Logger.log("String_Node_Str");
  GLFW3.terminate();
  Logger.log("String_Node_Str" + getVersion() + "String_Node_Str");
}
Program: 96918
Project: 96918
Buggy source:
public boolean isPrimary(){
  return monitors.get(0).equals(this);
}

Fixed version (ground truth):
public boolean isPrimary(){
  return getMonitors().get(0).equals(this);
}
Program: 96919
Project: 96919
Buggy source:
private static Window createWindow(int width,int height,String title,Monitor monitor,Window share){
  if (Game.getBatcher() != null)   Game.getBatcher().dispose();
  setHints();
  Window window=new Window(width,height,title,monitor,share);
  window.makeCurrent();
  setCallbacks(window);
  clearHints();
  dirty=true;
  Game.setBatcher(new Batcher());
  return window;
}

Fixed version (ground truth):
private static Window createWindow(int width,int height,String title,Monitor monitor,Window share){
  if (Game.getBatcher() != null)   Game.getBatcher().dispose();
  setHints();
  Window window=new Window(width,height,title,monitor,share);
  window.makeCurrent();
  setCallbacks(window);
  clearHints();
  window.setPosition(posX,posY);
  dirty=true;
  Game.setBatcher(new Batcher());
  return window;
}
Program: 96920
Project: 96920
Buggy source:
public static void setResizable(boolean resizable){
  if (Display.resizable == resizable)   return;
  Window resizableWindow=createWindow(width,height,getTitle(),monitor,displayWindow);
  displayWindow.destroy();
  displayWindow=resizableWindow;
  displayWindow.show();
  displayWindow.makeCurrent();
  Display.resizable=resizable;
  dirty=true;
}

Fixed version (ground truth):
public static void setResizable(boolean resizable){
  if (Display.resizable == resizable)   return;
  Display.resizable=resizable;
  Window resizableWindow=createWindow(width,height,getTitle(),monitor,displayWindow);
  displayWindow.destroy();
  displayWindow=resizableWindow;
  displayWindow.makeCurrent();
  dirty=true;
  hide();
  show();
  update();
}
Program: 96922
Project: 96922
Buggy source:
public Quaternion slerpSelf(Quaternion target,float alpha){
  final float dot=dot(target);
  float scale1, scale2;
  if ((1 - dot) > 0.1) {
    float angle=MathUtils.acos(dot);
    float sinAngle=1f / MathUtils.sin(angle);
    scale1=MathUtils.sin((1f - alpha) * angle) * sinAngle;
    scale2=MathUtils.sin((alpha * angle)) * sinAngle;
  }
 else {
    scale1=1f - alpha;
    scale2=alpha;
  }
  if (dot < 0.f)   scale2=-scale2;
  x=(scale1 * x) + (scale2 * target.x);
  y=(scale1 * y) + (scale2 * target.y);
  z=(scale1 * z) + (scale2 * target.z);
  w=(scale1 * w) + (scale2 * target.w);
  return this;
}

Fixed version (ground truth):
public Quaternion slerpSelf(Quaternion target,float alpha){
  final float dot=dot(target);
  float scale1, scale2;
  if ((1 - dot) > 0.1)   return lerpSelf(target,alpha);
  scale1=1f - alpha;
  scale2=alpha;
  if (dot < 0.f)   scale2=-scale2;
  x=(scale1 * x) + (scale2 * target.x);
  y=(scale1 * y) + (scale2 * target.y);
  z=(scale1 * z) + (scale2 * target.z);
  w=(scale1 * w) + (scale2 * target.w);
  return this;
}
Program: 96923
Project: 96923
Buggy source:
public void normal(Vector3 n){
  normal(n.getX(),n.getY(),n.getZ(),1);
}

Fixed version (ground truth):
public void normal(Vector3 n){
  normal(n.getX(),n.getY(),n.getZ(),0);
}
Program: 96924
Project: 96924
Buggy source:
private AABB getAABB(Entity3D e){
  AABB aabb;
  if (aabbMap.containsKey(e.getID()))   aabb=aabbMap.get(e.getID());
 else {
    aabb=AABB.create(e);
    aabbMap.put(e.getID(),aabb);
  }
  Cuboid bounds=e.getBounds();
  aabb.min.set(e.getPosition()).subtractSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(aabb.min).addSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  return aabb;
}

Fixed version (ground truth):
private AABB getAABB(Entity3D e){
  AABB aabb;
  if (aabbMap.containsKey(e.getID()))   aabb=aabbMap.get(e.getID());
 else {
    aabb=AABB.create(e);
    aabbMap.put(e.getID(),aabb);
  }
  Cuboid bounds=e.getBounds();
  aabb.min.set(e.getPosition()).subtractSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(e.getPosition()).addSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  return aabb;
}
Program: 96925
Project: 96925
Buggy source:
@Override public List<Entity3D> retrieve(Polyhedron bounds){
  retrieveList.clear();
  AABB aabb=new AABB();
  aabb.min.set(bounds.getPosition()).subtractSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(aabb.min).addSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  queryNode(aabb,root);
  return retrieveList;
}

Fixed version (ground truth):
@Override public List<Entity3D> retrieve(Polyhedron bounds){
  retrieveList.clear();
  AABB aabb=new AABB();
  aabb.min.set(bounds.getPosition()).subtractSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(bounds.getPosition()).addSelf(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  queryNode(aabb,root);
  return retrieveList;
}
Program: 96926
Project: 96926
Buggy source:
public void alignNextTo(Entity3D other){
  Vector3 tCenter=getPosition();
  Vector3 oCenter=other.getPosition();
  Vector3 direction=Vector3.REUSABLE_STACK.pop();
  direction.set(tCenter).subtractSelf(oCenter).normalizeSelf();
  setPosition(position.addSelf(direction));
  Collision3D.Response response=new Collision3D.Response();
  Collision3D.testPolyhedronCollision(polyhedron,other.polyhedron,response);
  setPosition(position.subtractSelf(response.getMinimumTranslationVector()));
  Vector3.REUSABLE_STACK.push(direction);
}

Fixed version (ground truth):
public void alignNextTo(Entity3D other){
  Collision3D.Response response=new Collision3D.Response();
  boolean intersection;
  do {
    response.clear();
    Collision3D.testPolyhedronCollision(polyhedron,other.polyhedron,response);
    intersection=response.getOverlapDistance() != 0;
    Vector3 mtv=response.getMinimumTranslationVector();
    setPosition(position.subtractSelf(mtv));
  }
 while (intersection);
}
Program: 96928
Project: 96928
Buggy source:
/** 
 * Rotates the entity by a specified angle
 * @param rx The angle to rate with on X-axis (in degrees)
 * @param ry The angle to rate with on Y-axis (in degrees)
 * @param rz The angle to rate with on Z-axis (in degrees)
 */
public void rotate(float rx,float ry,float rz){
  polyhedron.rotate(rx,ry,rz);
  getLocalTransform().reset().translate(getPosition()).rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}

Fixed version (ground truth):
/** 
 * Rotates the entity by a specified angle
 * @param rx The angle to rate with on X-axis (in degrees)
 * @param ry The angle to rate with on Y-axis (in degrees)
 * @param rz The angle to rate with on Z-axis (in degrees)
 */
public void rotate(float rx,float ry,float rz){
  polyhedron.rotate(rx,ry,rz);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}
Program: 96929
Project: 96929
Buggy source:
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector3
 */
public void setPosition(Vector3 position){
  this.position=position;
  polyhedron.setPosition(position);
  getLocalTransform().reset().translate(getPosition()).rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY());
}

Fixed version (ground truth):
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector3
 */
public void setPosition(Vector3 position){
  this.position=position;
  polyhedron.setPosition(position);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}
Program: 96930
Project: 96930
Buggy source:
/** 
 * Prepares this Entity3D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector3.ZERO)   return;
  position.addSelf(velocity);
  polyhedron.setPosition(position);
  getLocalTransform().reset().translate(getPosition()).rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY());
}

Fixed version (ground truth):
/** 
 * Prepares this Entity3D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector3.ZERO)   return;
  position.addSelf(velocity);
  polyhedron.setPosition(position);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}
Program: 96931
Project: 96931
Buggy source:
public Cuboid(Vector3 min,Vector3 max){
  this();
  Vector3 size=max.subtract(min);
  width=size.x;
  height=size.y;
  thickness=size.z;
  setPosition(min.add(max).scale(0.5f));
  updateVertices();
}

Fixed version (ground truth):
public Cuboid(Vector3 min,Vector3 max){
  this();
  Vector3 size=max.subtract(min);
  width=size.x;
  height=size.y;
  thickness=size.z;
  setPosition(min.add(max).scaleSelf(0.5f));
  updateVertices();
}
Program: 96932
Project: 96932
Buggy source:
public float getThickness(){
  return getBounds().getThickness();
}

Fixed version (ground truth):
public float getThickness(){
  return maxZ - minZ;
}
Program: 96933
Project: 96933
Buggy source:
public float getWidth(){
  return getBounds().getWidth();
}

Fixed version (ground truth):
public float getWidth(){
  return maxX - minX;
}
Program: 96934
Project: 96934
Buggy source:
public float getHeight(){
  return getBounds().getHeight();
}

Fixed version (ground truth):
public float getHeight(){
  return maxY - minY;
}
Program: 96935
Project: 96935
Buggy source:
public FPSCamera move(Vector3 dir,float amount){
  Vector3 deltaMove=position.add(dir.normalize().scale(amount));
  deltaMove.y=0;
  position=position.add(deltaMove);
  return this;
}

Fixed version (ground truth):
public FPSCamera move(Vector3 dir,float amount){
  Vector3 deltaMove=position.add(dir.normalizeSelf().scaleSelf(amount));
  deltaMove.y=0;
  position=position.add(deltaMove);
  return this;
}
Program: 96936
Project: 96936
Buggy source:
public void apply(){
  super.apply();
  mView.initIdentity().multiply(TransformUtils.createTranslation(position.negate())).multiply(TransformUtils.createRotation(rotation));
  GL3Context.enable(GL11.GL_DEPTH_TEST);
}

Fixed version (ground truth):
public void apply(){
  super.apply();
  Vector3 temp=Vector3.REUSABLE_STACK.pop();
  mView.initIdentity().multiply(TransformUtils.createTranslation(temp.set(position).negateSelf())).multiply(TransformUtils.createRotation(rotation));
  Vector3.REUSABLE_STACK.push(temp);
  GL3Context.enable(GL11.GL_DEPTH_TEST);
}
Program: 96937
Project: 96937
Buggy source:
public void setPosition(Vector3 position){
  this.position=position;
}

Fixed version (ground truth):
public void setPosition(Vector3 position){
  this.position.set(position);
}
Program: 96938
Project: 96938
Buggy source:
public void apply(){
  super.apply();
  mView.initIdentity().multiply(TransformUtils.createTranslation(tempVec3.set(position).negateSelf())).multiply(TransformUtils.createRotation(rotation));
  GL3Context.enable(GL11.GL_DEPTH_TEST);
}

Fixed version (ground truth):
public void apply(){
  super.apply();
  Vector3 tempVec3=Vector3.REUSABLE_STACK.pop();
  mView.initIdentity().multiply(TransformUtils.createTranslation(tempVec3.set(position).negateSelf())).multiply(TransformUtils.createRotation(rotation));
  Vector3.REUSABLE_STACK.push(tempVec3);
  GL3Context.enable(GL11.GL_DEPTH_TEST);
}
Program: 96939
Project: 96939
Buggy source:
public PerspCam lookAt(Vector3 point){
  Vector3 forward=point.subtract(position).normalizeSelf();
  Vector3 up=Vector3.AXIS_Y;
  Vector3 negativeZ=tempVec.set(Vector3.AXIS_Z).negateSelf();
  float dot=negativeZ.dot(forward);
  if (Math.abs(dot + 1) < 0.000001f) {
    rotation.set(up.x,up.y,up.z,(float)Math.PI);
    return this;
  }
  if (Math.abs(dot - 1) < 0.000001f) {
    rotation.set();
    return this;
  }
  float rotAngle=MathUtils.acos(dot);
  Vector3 rotAxis=negativeZ.crossSelf(forward).normalizeSelf();
  rotation.set(rotAxis,rotAngle);
  return this;
}

Fixed version (ground truth):
public PerspCam lookAt(Vector3 point){
  Vector3 temp=Vector3.REUSABLE_STACK.pop();
  Vector3 forward=temp.set(point).subtractSelf(position).normalizeSelf();
  Vector3 up=Vector3.AXIS_Y;
  Vector3 negativeZ=tempVec.set(Vector3.AXIS_Z).negateSelf();
  float dot=negativeZ.dot(forward);
  if (Math.abs(dot + 1) < 0.000001f) {
    rotation.set(up.x,up.y,up.z,(float)Math.PI);
    return this;
  }
  if (Math.abs(dot - 1) < 0.000001f) {
    rotation.set();
    return this;
  }
  float rotAngle=MathUtils.acos(dot);
  Vector3 rotAxis=negativeZ.crossSelf(forward).normalizeSelf();
  rotation.set(rotAxis,rotAngle);
  Vector3.REUSABLE_STACK.push(temp);
  return this;
}
Program: 96940
Project: 96940
Buggy source:
public void setPosition(Vector3 position){
  this.position=position;
}

Fixed version (ground truth):
public void setPosition(Vector3 position){
  this.position.set(position);
}
Program: 96941
Project: 96941
Buggy source:
/** 
 * Rotates the entity by a specified angle
 * @param angle The angle to rate with (in degrees)
 */
public void rotate(float angle){
  polygon.rotate(angle);
  getLocalTransform().reset().translate(getPosition().subtract(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}

Fixed version (ground truth):
/** 
 * Rotates the entity by a specified angle
 * @param angle The angle to rate with (in degrees)
 */
public void rotate(float angle){
  polygon.rotate(angle);
  getLocalTransform().reset().translate(tempVec2.set(getPosition()).subtractSelf(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}
Program: 96942
Project: 96942
Buggy source:
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector2
 */
public void setPosition(Vector2 position){
  this.position=position;
  polygon.setPosition(position);
  getLocalTransform().reset().translate(getPosition().subtract(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}

Fixed version (ground truth):
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector2
 */
public void setPosition(Vector2 position){
  this.position.set(position);
  polygon.setPosition(position);
  getLocalTransform().reset().translate(tempVec2.set(getPosition()).subtractSelf(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}
Program: 96943
Project: 96943
Buggy source:
/** 
 * Sets the velocity of this entity
 * @param velocity The velocity as a Vector2
 */
public void setVelocity(Vector2 velocity){
  this.velocity=velocity;
}

Fixed version (ground truth):
/** 
 * Sets the velocity of this entity
 * @param velocity The velocity as a Vector2
 */
public void setVelocity(Vector2 velocity){
  this.velocity.set(velocity);
}
Program: 96944
Project: 96944
Buggy source:
/** 
 * Sets the center position of this entity. Note that the same rotation is also applied to the polygon this entity is using.
 * @param center The new center position
 */
public void setCenter(Vector2 center){
  polygon.setCenter(center);
  position=polygon.getPosition();
  getLocalTransform().reset().translate(getPosition().subtract(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}

Fixed version (ground truth):
/** 
 * Sets the center position of this entity. Note that the same rotation is also applied to the polygon this entity is using.
 * @param center The new center position
 */
public void setCenter(Vector2 center){
  polygon.setCenter(center);
  position.set(polygon.getPosition());
  getLocalTransform().reset().translate(tempVec2.set(getPosition()).subtractSelf(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}
Program: 96945
Project: 96945
Buggy source:
/** 
 * Sets the rotation of this entity. Note that the same rotation is also applied to the polygon this entity is using.
 * @param rotation The amount of rotation (in degrees)
 */
public void setRotation(float rotation){
  polygon.setRotation(rotation);
  getLocalTransform().reset().translate(getPosition().subtract(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}

Fixed version (ground truth):
/** 
 * Sets the rotation of this entity. Note that the same rotation is also applied to the polygon this entity is using.
 * @param rotation The amount of rotation (in degrees)
 */
public void setRotation(float rotation){
  polygon.setRotation(rotation);
  getLocalTransform().reset().translate(tempVec2.set(getPosition()).subtractSelf(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}
Program: 96946
Project: 96946
Buggy source:
public void alignNextTo(Entity2D other){
  Vector2 tCenter=getCenter();
  Vector2 oCenter=other.getCenter();
  Vector2 direction=tCenter.subtract(oCenter).normalizeSelf();
  setCenter(direction.addSelf(getCenter()));
  Collision2D.Response response=new Collision2D.Response();
  Collision2D.testPolygonCollision(polygon,other.getPolygon(),response);
  setPosition(position.subtract(response.getMinimumTranslationVector()));
}

Fixed version (ground truth):
public void alignNextTo(Entity2D other){
  Vector2 tCenter=getCenter();
  Vector2 oCenter=other.getCenter();
  Vector2 direction=tCenter.subtract(oCenter).normalizeSelf();
  setCenter(direction.addSelf(getCenter()));
  Collision2D.Response response=new Collision2D.Response();
  Collision2D.testPolygonCollision(polygon,other.getPolygon(),response);
  setPosition(tempVec2.set(position).subtractSelf(response.getMinimumTranslationVector()));
}
Program: 96947
Project: 96947
Buggy source:
/** 
 * Prepares this Entity2D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector2.ZERO)   return;
  position=position.add(velocity);
  polygon.setPosition(position);
  getLocalTransform().reset().translate(getPosition().subtract(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}

Fixed version (ground truth):
/** 
 * Prepares this Entity2D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector2.ZERO)   return;
  setPosition(tempVec2.set(position).addSelf(velocity));
  getLocalTransform().reset().translate(tempVec2.set(getPosition()).subtractSelf(getCenter())).rotate(Vector3.AXIS_Z,polygon.getRotation()).translate(getCenter());
}
Program: 96948
Project: 96948
Buggy source:
public Vector2(Vector4 v){
  x=v.x;
  y=v.y;
}

Fixed version (ground truth):
public Vector2(Vector4 v){
  this(v.x,v.y);
}
Program: 96949
Project: 96949
Buggy source:
public void render(float delta,Batcher batcher){
  RenderUtils.fillPolygon(batcher,getPolygon(),getVelocity().scale(delta),color);
  RenderUtils.tracePolygon(batcher,getPolygon(),getVelocity().scale(delta),Color.GREEN);
}

Fixed version (ground truth):
public void render(float delta,Batcher batcher){
  RenderUtils.fillPolygon(batcher,getPolygon(),temp.set(getVelocity()),color);
  RenderUtils.tracePolygon(batcher,getPolygon(),temp.set(getVelocity()),Color.GREEN);
}
Program: 96950
Project: 96950
Buggy source:
public void render(float delta,Batcher batcher){
  cam.apply();
  scene.render(delta,batcher);
  RenderUtils.tracePolyhedron(batcher,entity.getPolyhedron());
}

Fixed version (ground truth):
public void render(float delta,Batcher batcher){
  cam.apply();
  scene.render(delta,batcher);
}
Program: 96951
Project: 96951
Buggy source:
public static void fillPolygon(Batcher b,Polygon polygon,Vector2 position,Color color){
  b.begin(Primitive.TRIANGLE_FAN);
{
    for (    Vector2 vertex : polygon.getVertices()) {
      b.vertex(tempVec2.set(vertex).addSelf(polygon.getPosition().addSelf(position)));
      b.color(color);
    }
  }
  b.end();
}

Fixed version (ground truth):
public static void fillPolygon(Batcher b,Polygon polygon,Vector2 position,Color color){
  b.begin(Primitive.TRIANGLE_FAN);
{
    for (    Vector2 vertex : polygon.getVertices()) {
      b.vertex(tempVec2.set(vertex).addSelf(polygon.getPosition()).addSelf(position));
      b.color(color);
    }
  }
  b.end();
}
Program: 96952
Project: 96952
Buggy source:
public static void tracePolygon(Batcher b,Polygon polygon,Vector2 position,Color color){
  b.begin(Primitive.LINE_LOOP);
{
    for (    Vector2 vertex : polygon.getVertices()) {
      b.vertex(tempVec2.set(vertex).addSelf(polygon.getPosition().addSelf(position)));
      b.color(color);
    }
  }
  b.end();
}

Fixed version (ground truth):
public static void tracePolygon(Batcher b,Polygon polygon,Vector2 position,Color color){
  b.begin(Primitive.LINE_LOOP);
{
    for (    Vector2 vertex : polygon.getVertices()) {
      b.vertex(tempVec2.set(vertex).addSelf(polygon.getPosition()).addSelf(position));
      b.color(color);
    }
  }
  b.end();
}
Program: 96953
Project: 96953
Buggy source:
public Vector3 multiply(Vector3 v,Vector3 dest){
  Vector3 tempVec3=Vector3.REUSABLE_STACK.pop();
  Quaternion temp1=Quaternion.REUSABLE_STACK.pop();
  Quaternion temp2=Quaternion.REUSABLE_STACK.pop();
  Quaternion temp3=Quaternion.REUSABLE_STACK.pop();
  Vector3 vn=tempVec3.set(v).normalizeSelf();
  Quaternion q1=temp1.set(this).conjugateSelf();
  Quaternion qv=temp2.set(vn.x,vn.y,vn.z,1);
  qv=temp3.set(this).multiplySelf(qv);
  qv.multiplySelf(q1);
  dest.set(qv.x,qv.y,qv.z).normalizeSelf().scaleSelf(v.length());
  Vector3.REUSABLE_STACK.push(tempVec3);
  Quaternion.REUSABLE_STACK.push(temp1);
  Quaternion.REUSABLE_STACK.push(temp2);
  Quaternion.REUSABLE_STACK.push(temp3);
  return dest;
}

Fixed version (ground truth):
public Vector3 multiply(Vector3 v,Vector3 dest){
  Vector3 temp=Vector3.REUSABLE_STACK.pop();
  Quaternion temp1=Quaternion.REUSABLE_STACK.pop();
  Quaternion temp2=Quaternion.REUSABLE_STACK.pop();
  Quaternion temp3=Quaternion.REUSABLE_STACK.pop();
  v=temp.set(v).normalizeSelf();
  Quaternion q1=temp1.set(this).conjugateSelf();
  Quaternion qv=temp2.set(v.x,v.y,v.z,1);
  Quaternion q=this;
  Quaternion res=temp3.set(q).multiplySelf(qv.multiplySelf(q1));
  dest.x=res.x;
  dest.y=res.y;
  dest.z=res.z;
  Vector3.REUSABLE_STACK.push(temp);
  Quaternion.REUSABLE_STACK.push(temp1);
  Quaternion.REUSABLE_STACK.push(temp2);
  Quaternion.REUSABLE_STACK.push(temp3);
  return dest;
}
Program: 96954
Project: 96954
Buggy source:
/** 
 * Rotates the entity by a specified angle
 * @param rx The angle to rate with on X-axis (in degrees)
 * @param ry The angle to rate with on Y-axis (in degrees)
 * @param rz The angle to rate with on Z-axis (in degrees)
 */
public void rotate(float rx,float ry,float rz){
  polyhedron.rotate(rx,ry,rz);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}

Fixed version (ground truth):
/** 
 * Rotates the entity by a specified angle
 * @param rx The angle to rate with on X-axis (in degrees)
 * @param ry The angle to rate with on Y-axis (in degrees)
 * @param rz The angle to rate with on Z-axis (in degrees)
 */
public void rotate(float rx,float ry,float rz){
  polyhedron.rotate(rx,ry,rz);
  updateTransforms();
}
Program: 96955
Project: 96955
Buggy source:
/** 
 * Sets the y-coordinate of the position
 * @param y The y-coordinate of the position
 */
public void setY(float y){
  position.setY(y);
  polyhedron.setPosition(position);
}

Fixed version (ground truth):
/** 
 * Sets the y-coordinate of the position
 * @param y The y-coordinate of the position
 */
public void setY(float y){
  position.setY(y);
  polyhedron.setPosition(position);
  updateTransforms();
}
Program: 96956
Project: 96956
Buggy source:
/** 
 * Sets the x-coordinate of the position
 * @param x The x-coordinate of the position
 */
public void setX(float x){
  position.setX(x);
  polyhedron.setPosition(position);
}

Fixed version (ground truth):
/** 
 * Sets the x-coordinate of the position
 * @param x The x-coordinate of the position
 */
public void setX(float x){
  position.setX(x);
  polyhedron.setPosition(position);
  updateTransforms();
}
Program: 96957
Project: 96957
Buggy source:
/** 
 * Sets the z-coordinate of the position
 * @param z The z-coordinate of the position
 */
public void setZ(float z){
  position.setZ(z);
  polyhedron.setPosition(position);
}

Fixed version (ground truth):
/** 
 * Sets the z-coordinate of the position
 * @param z The z-coordinate of the position
 */
public void setZ(float z){
  position.setZ(z);
  polyhedron.setPosition(position);
  updateTransforms();
}
Program: 96958
Project: 96958
Buggy source:
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector3
 */
public void setPosition(Vector3 position){
  this.position=position;
  polyhedron.setPosition(position);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}

Fixed version (ground truth):
/** 
 * Sets the position of this entity
 * @param position The new position as a Vector3
 */
public void setPosition(Vector3 position){
  this.position.set(position);
  polyhedron.setPosition(position);
  updateTransforms();
}
Program: 96959
Project: 96959
Buggy source:
/** 
 * Prepares this Entity3D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector3.ZERO)   return;
  position.addSelf(velocity);
  polyhedron.setPosition(position);
  getLocalTransform().reset().rotate(Vector3.AXIS_X,polyhedron.getRotationX()).rotate(Vector3.AXIS_Z,polyhedron.getRotationZ()).rotate(Vector3.AXIS_Y,polyhedron.getRotationY()).translate(getPosition());
}

Fixed version (ground truth):
/** 
 * Prepares this Entity3D for a new frame. This method is not meant to be called by the user and is called by the SceneGraph.
 * @param delta The delta time.
 */
public void preUpdate(float delta){
  if (isDestroyed())   return;
  update(delta);
  if (velocity == Vector3.ZERO)   return;
  position.addSelf(velocity);
  polyhedron.setPosition(position);
  updateTransforms();
}
Program: 96960
Project: 96960
Buggy source:
public void setPosition(Vector3 position){
  this.position=position;
  if (bounds != null)   bounds.setPosition(position);
}

Fixed version (ground truth):
public void setPosition(Vector3 position){
  this.position.set(position);
  if (bounds != null)   bounds.setPosition(position);
}
Program: 96961
Project: 96961
Buggy source:
@Override public void checkCollisions(){
  if (scene.getChildren().size() != childrenInScene) {
    entities.clear();
    quadTree.clear();
    childrenInScene=0;
    for (    SceneNode child : scene.getChildren()) {
      if (child instanceof Entity2D) {
        Entity2D entity=(Entity2D)child;
        quadTree.insert(entity);
        entities.add(entity);
      }
      childrenInScene++;
    }
  }
  for (  Entity2D entity : entities) {
    if (entity.getVelocity() != Vector2.ZERO) {
      quadTree.remove(entity);
      quadTree.insert(entity);
    }
  }
  for (  Class<? extends Entity2D> class1 : collisionMap.keySet())   for (  Entity2D entity : entities)   if (class1.isInstance(entity)) {
    List<Entity2D> collidables=quadTree.retrieve(entity);
    for (    Entity2D entity2 : collidables)     if (collisionMap.get(class1).isInstance(entity2))     if (entity.getPolygon().intersects(entity2.getPolygon()))     entity.collision(entity2);
  }
}

Fixed version (ground truth):
@Override public void checkCollisions(){
  if (scene.getChildren().size() != childrenInScene) {
    entities.clear();
    quadTree.clear();
    childrenInScene=0;
    for (    SceneNode child : scene.getChildren()) {
      if (child instanceof Entity2D) {
        Entity2D entity=(Entity2D)child;
        quadTree.insert(entity);
        entities.add(entity);
      }
      childrenInScene++;
    }
  }
  for (  Entity2D entity : entities) {
    if (entity.getVelocity() != Vector2.ZERO) {
      quadTree.remove(entity);
      quadTree.insert(entity);
    }
  }
  for (  Class<? extends Entity2D> class1 : collisionMap.keySet())   for (  Entity2D entity : entities)   if (class1.isInstance(entity)) {
    List<Entity2D> collidables=quadTree.retrieve(entity);
    for (    Entity2D entity2 : collidables)     if (collisionMap.get(class1).isInstance(entity2))     if (entity != entity2)     if (entity.getPolygon().intersects(entity2.getPolygon()))     entity.collision(entity2);
  }
}
Program: 96962
Project: 96962
Buggy source:
public boolean isBInsideA(){
  return bInA;
}

Fixed version (ground truth):
public boolean isBInsideA(){
  return bInA && intersection;
}
Program: 96963
Project: 96963
Buggy source:
public Vector2 getOverlapAxis(){
  return overlapN;
}

Fixed version (ground truth):
public Vector2 getOverlapAxis(){
  return intersection ? overlapN : Vector2.ZERO;
}
Program: 96964
Project: 96964
Buggy source:
public boolean isAInsideB(){
  return aInB;
}

Fixed version (ground truth):
public boolean isAInsideB(){
  return aInB && intersection;
}
Program: 96965
Project: 96965
Buggy source:
public static boolean testPolygonCollision(Polygon a,Polygon b,Response response){
  if (response == null)   response=tmpResponse.clear();
  for (int i=0; i < a.vertexCount(); i++) {
    Vector2 e1=a.getVertex(i);
    Vector2 e2=a.getVertex((i + 1) % a.vertexCount());
    Vector2 edge=e2.subtract(e1);
    Vector2 normal=edge.perpendicular().normalize();
    if (isSeparatingAxis(a,b,normal,response))     return false;
  }
  for (int i=0; i < b.vertexCount(); i++) {
    Vector2 e1=b.getVertex(i);
    Vector2 e2=b.getVertex((i + 1) % b.vertexCount());
    Vector2 edge=e2.subtract(e1);
    Vector2 normal=edge.perpendicular().normalize();
    if (isSeparatingAxis(a,b,normal,response))     return false;
  }
  response.a=a;
  response.b=b;
  response.overlapV=response.overlapN.scale(response.overlap);
  return true;
}

Fixed version (ground truth):
public static boolean testPolygonCollision(Polygon a,Polygon b,Response response){
  if (response == null)   response=tmpResponse.clear();
  for (int i=0; i < a.vertexCount(); i++) {
    Vector2 e1=a.getVertex(i);
    Vector2 e2=a.getVertex((i + 1) % a.vertexCount());
    Vector2 edge=e2.subtract(e1);
    Vector2 normal=edge.perpendicular().normalize();
    if (isSeparatingAxis(a,b,normal,response))     return false;
  }
  for (int i=0; i < b.vertexCount(); i++) {
    Vector2 e1=b.getVertex(i);
    Vector2 e2=b.getVertex((i + 1) % b.vertexCount());
    Vector2 edge=e2.subtract(e1);
    Vector2 normal=edge.perpendicular().normalize();
    if (isSeparatingAxis(a,b,normal,response))     return false;
  }
  response.a=a;
  response.b=b;
  response.overlapV=response.overlapN.scale(response.overlap);
  response.intersection=true;
  return true;
}
Program: 96966
Project: 96966
Buggy source:
public Response clear(){
  aInB=true;
  bInA=true;
  overlap=Float.MAX_VALUE;
  return this;
}

Fixed version (ground truth):
public Response clear(){
  aInB=true;
  bInA=true;
  intersection=false;
  overlap=Float.MAX_VALUE;
  return this;
}
Program: 96967
Project: 96967
Buggy source:
public float getOverlapDistance(){
  return overlap;
}

Fixed version (ground truth):
public float getOverlapDistance(){
  return intersection ? overlap : 0;
}
Program: 96968
Project: 96968
Buggy source:
public Vector2 getMinimumTranslationVector(){
  return overlapV;
}

Fixed version (ground truth):
public Vector2 getMinimumTranslationVector(){
  return intersection ? overlapV : Vector2.ZERO;
}
Program: 96969
Project: 96969
Buggy source:
public boolean isBInsideA(){
  return bInA;
}

Fixed version (ground truth):
public boolean isBInsideA(){
  return bInA && intersection;
}
Program: 96970
Project: 96970
Buggy source:
public Vector3 getOverlapAxis(){
  return overlapN;
}

Fixed version (ground truth):
public Vector3 getOverlapAxis(){
  return intersection ? overlapN : Vector3.ZERO;
}
Program: 96971
Project: 96971
Buggy source:
public boolean isAInsideB(){
  return aInB;
}

Fixed version (ground truth):
public boolean isAInsideB(){
  return aInB && intersection;
}
Program: 96972
Project: 96972
Buggy source:
public Response clear(){
  aInB=true;
  bInA=true;
  overlap=Float.MAX_VALUE;
  return this;
}

Fixed version (ground truth):
public Response clear(){
  aInB=true;
  bInA=true;
  intersection=false;
  overlap=Float.POSITIVE_INFINITY;
  return this;
}
Program: 96973
Project: 96973
Buggy source:
public static boolean isSeparatingAxis(Polyhedron a,Polyhedron b,Vector3 axis,Response response){
  if (response == null)   response=tmpResponse.clear();
  Vector3 offset=b.getPosition().subtract(a.getPosition());
  float projectedOffset=offset.dot(axis);
  Vector2 rangeA=flattenPoints(a.getVertices(),axis);
  Vector2 rangeB=flattenPoints(b.getVertices(),axis);
  rangeB=rangeB.add(projectedOffset,projectedOffset);
  if (rangeA.x > rangeB.y || rangeB.x > rangeA.y)   return true;
  float overlap=0;
  if (rangeA.x < rangeB.x) {
    response.aInB=false;
    if (rangeA.y < rangeB.y) {
      overlap=rangeA.y - rangeB.x;
      response.bInA=false;
    }
 else {
      float option1=rangeA.y - rangeB.x;
      float option2=rangeB.y - rangeA.x;
      overlap=option1 < option2 ? option1 : -option2;
    }
  }
 else {
    response.bInA=false;
    if (rangeA.y > rangeB.y) {
      overlap=rangeA.y - rangeB.x;
      response.aInB=false;
    }
 else {
      float option1=rangeA.y - rangeB.x;
      float option2=rangeB.y - rangeA.x;
      overlap=option1 < option2 ? option1 : -option2;
    }
  }
  overlap=Math.abs(overlap);
  if (overlap < response.overlap) {
    response.overlap=overlap;
    response.overlapN.set(axis.normalize());
    if (overlap < 0)     response.overlapN=response.overlapN.negate();
  }
  return false;
}

Fixed version (ground truth):
public static boolean isSeparatingAxis(Polyhedron a,Polyhedron b,Vector3 axis,Response response){
  if (response == null)   response=tmpResponse.clear();
  axis.x=(axis.x == -0f) ? -1 : axis.x;
  axis.y=(axis.y == -0f) ? -1 : axis.y;
  axis.z=(axis.z == -0f) ? -1 : axis.z;
  Vector3 offset=b.getPosition().subtract(a.getPosition());
  float projectedOffset=offset.dot(axis);
  Vector2 rangeA=flattenPoints(a.getVertices(),axis);
  Vector2 rangeB=flattenPoints(b.getVertices(),axis);
  rangeB=rangeB.add(projectedOffset,projectedOffset);
  if (rangeA.x > rangeB.y || rangeB.x > rangeA.y)   return true;
  float overlap;
  if (rangeA.x < rangeB.x) {
    response.aInB=false;
    if (rangeA.y < rangeB.y) {
      overlap=rangeA.y - rangeB.x;
      response.bInA=false;
    }
 else {
      float option1=rangeA.y - rangeB.x;
      float option2=rangeB.y - rangeA.x;
      overlap=option1 < option2 ? option1 : -option2;
    }
  }
 else {
    response.bInA=false;
    if (rangeA.y > rangeB.y) {
      overlap=rangeA.y - rangeB.x;
      response.aInB=false;
    }
 else {
      float option1=rangeA.y - rangeB.x;
      float option2=rangeB.y - rangeA.x;
      overlap=option1 < option2 ? option1 : -option2;
    }
  }
  overlap=Math.abs(overlap);
  if (overlap < response.overlap) {
    response.overlap=overlap;
    response.overlapN.set(axis.normalize());
    if (overlap < 0)     response.overlapN=response.overlapN.negate();
  }
  return false;
}
Program: 96974
Project: 96974
Buggy source:
public float getOverlapDistance(){
  return overlap;
}

Fixed version (ground truth):
public float getOverlapDistance(){
  return intersection ? overlap : 0;
}
Program: 96975
Project: 96975
Buggy source:
public Vector3 getMinimumTranslationVector(){
  return overlapV;
}

Fixed version (ground truth):
public Vector3 getMinimumTranslationVector(){
  return intersection ? overlapV : Vector3.ZERO;
}
Program: 96976
Project: 96976
Buggy source:
private void rotate(Vector3 axis,float angle){
  minX=minY=minZ=Float.POSITIVE_INFINITY;
  maxX=maxY=maxZ=Float.NEGATIVE_INFINITY;
  for (  Vector3 v : vertices) {
    v.set(v.rotate(axis,angle).scale(2));
    minX=Math.min(minX,v.x);
    minY=Math.min(minY,v.y);
    minZ=Math.min(minZ,v.z);
    maxX=Math.max(maxX,v.x);
    maxY=Math.max(maxY,v.y);
    maxZ=Math.max(maxZ,v.z);
  }
  bounds=new Cuboid(new Vector3(minX / 2,minY / 2,minZ / 2).add(position),new Vector3(maxX / 2,maxY / 2,maxZ / 2).add(position));
}

Fixed version (ground truth):
private void rotate(Vector3 axis,float angle){
  minX=minY=minZ=Float.POSITIVE_INFINITY;
  maxX=maxY=maxZ=Float.NEGATIVE_INFINITY;
  for (  Vector3 v : vertices) {
    v.set(v.rotate(axis.normalize(),angle));
    minX=Math.min(minX,v.x);
    minY=Math.min(minY,v.y);
    minZ=Math.min(minZ,v.z);
    maxX=Math.max(maxX,v.x);
    maxY=Math.max(maxY,v.y);
    maxZ=Math.max(maxZ,v.z);
  }
  bounds=new Cuboid(new Vector3(minX / 2,minY / 2,minZ / 2).add(position),new Vector3(maxX / 2,maxY / 2,maxZ / 2).add(position));
}
Program: 96977
Project: 96977
Buggy source:
private void updateVertices(){
  clearVertices();
  final int bandPower=6;
  final int bandPoints=(int)Math.pow(2,bandPower);
  final int bandMask=bandPoints - 2;
  final int sectionsInBand=(bandPoints / 2) - 1;
  final int totalPoints=sectionsInBand * bandPoints;
  final float sectionArc=6.28f / sectionsInBand;
  final float radius=-this.radius;
  float xAngle;
  float yAngle;
  for (int i=0; i < totalPoints; i++) {
    xAngle=(float)(i & 1) + (i >> bandPower);
    yAngle=(float)((i & bandMask) >> 1) + ((i >> bandPower) * sectionsInBand);
    xAngle*=sectionArc / 2f;
    yAngle*=sectionArc * -1;
    float x=(float)(radius * Math.sin(xAngle) * Math.sin(yAngle));
    float y=(float)(radius * Math.cos(xAngle));
    float z=(float)(radius * Math.sin(xAngle) * Math.cos(yAngle));
    addVertex(new Vector3(x,y,z));
  }
}

Fixed version (ground truth):
private void updateVertices(){
  clearVertices();
  final int bandPower=6;
  final int bandPoints=(int)Math.pow(2,bandPower);
  final int bandMask=bandPoints - 2;
  final int sectionsInBand=(bandPoints / 2) - 1;
  final int totalPoints=sectionsInBand * bandPoints;
  final float sectionArc=6.28f / sectionsInBand;
  final float diameter=-(2 * this.radius);
  float xAngle;
  float yAngle;
  for (int i=0; i < totalPoints; i++) {
    xAngle=(float)(i & 1) + (i >> bandPower);
    yAngle=(float)((i & bandMask) >> 1) + ((i >> bandPower) * sectionsInBand);
    xAngle*=sectionArc / 2f;
    yAngle*=sectionArc * -1;
    float x=(float)(diameter * Math.sin(xAngle) * Math.sin(yAngle));
    float y=(float)(diameter * Math.cos(xAngle));
    float z=(float)(diameter * Math.sin(xAngle) * Math.cos(yAngle));
    addVertex(new Vector3(x,y,z));
  }
}
Program: 96978
Project: 96978
Buggy source:
public Vector4 multiply(Vector4 v){
  return new Vector4().setX(m[0][0] * v.getX()).setY(m[0][1] * v.getY()).setZ(m[0][2] * v.getZ()).setW(m[0][3] * v.getW());
}

Fixed version (ground truth):
public Vector4 multiply(Vector4 v){
  float X=v.x;
  float Y=v.y;
  float Z=v.z;
  float W=1;
  float A=m[0][0], B=m[0][1], C=m[0][2], D=m[0][3];
  float E=m[1][0], F=m[1][1], G=m[1][2], H=m[1][3];
  float I=m[2][0], J=m[2][1], K=m[2][2], L=m[2][3];
  float M=m[3][0], N=m[3][1], O=m[3][2], P=m[3][3];
  return new Vector4(A * X + B * Y + C * Z + D * W,E * X + F * Y + G * Z + H * W,I * X + J * Y + K * Z + L * W,M * X + N * Y + O * Z + P * W);
}
Program: 96979
Project: 96979
Buggy source:
public Vector3 multiply(Vector3 v){
  Vector3 vn=v.normalize();
  Quaternion q1=conjugate();
  Quaternion qv=new Quaternion(vn.x,vn.y,vn.z,1);
  qv=this.multiply(qv);
  qv=qv.multiply(q1);
  return new Vector3(qv.x,qv.y,qv.z);
}

Fixed version (ground truth):
public Vector3 multiply(Vector3 v){
  Vector3 vn=v.normalize();
  Quaternion q1=conjugate();
  Quaternion qv=new Quaternion(vn.x,vn.y,vn.z,1);
  qv=this.multiply(qv);
  qv=qv.multiply(q1);
  return new Vector3(qv.x,qv.y,qv.z).normalize().scale(v.length());
}
Program: 96980
Project: 96980
Buggy source:
public void init(){
  camera=new PerspCam().initProjection(70,Display.getAspectRatio(),0.01f,1000f);
  camera.setPosition(new Vector3(-2,-2,5));
  camera.lookAt(Vector3.ZERO);
  cube=new Cuboid(new Vector3(),1,1,1);
  sphere=new Sphere(new Vector3(),1);
}

Fixed version (ground truth):
public void init(){
  ResourceLoader loader=ResourceLoader.getInstance();
  int fontID=loader.defineFont("String_Node_Str",TrueTypeFont.STYLE_NORMAL,16);
  loader.startLoading();
  hudFont=loader.getFont(fontID);
  camera=new PerspCam().initProjection(70,Display.getAspectRatio(),0.01f,1000f);
  camera.setPosition(new Vector3(-2,-2,5));
  camera.lookAt(Vector3.ZERO);
  hudCam=new OrthoCam().initProjection(Display.getWidth(),Display.getHeight());
  cube=new Cuboid(new Vector3(),1,1,1);
  sphere=new Sphere(new Vector3(),1);
}
Program: 96981
Project: 96981
Buggy source:
public void render(float delta,Batcher batcher){
  camera.apply();
  if (!sphere.intersects(cube)) {
    RenderUtils.fillPolyhedron(batcher,cube,Color.BLUE);
    RenderUtils.fillPolyhedron(batcher,sphere,Color.DARK_RED);
  }
 else {
    Collision3D.Response response=Collision3D.getResponse();
    batcher.begin(Primitive.LINES);
{
      batcher.vertex(cube.getPosition());
      batcher.color(Color.RED);
      batcher.vertex(cube.getPosition().add(response.getMinimumTranslationVector()));
      batcher.color(Color.RED);
    }
    batcher.end();
  }
  RenderUtils.tracePolyhedron(batcher,cube,Color.GREEN);
  RenderUtils.tracePolyhedron(batcher,sphere,Color.GREEN);
  RenderUtils.tracePolyhedron(batcher,cube.getBounds(),Color.WHITE);
  RenderUtils.tracePolyhedron(batcher,sphere.getBounds(),Color.WHITE);
}

Fixed version (ground truth):
public void render(float delta,Batcher batcher){
  camera.apply();
  boolean intersects=sphere.intersects(cube);
  Collision3D.Response response=Collision3D.getResponse();
  if (!intersects) {
    RenderUtils.fillPolyhedron(batcher,cube,Color.BLUE);
    RenderUtils.fillPolyhedron(batcher,sphere,Color.DARK_RED);
  }
 else {
    batcher.begin(Primitive.LINES);
{
      batcher.vertex(cube.getPosition());
      batcher.color(Color.RED);
      batcher.vertex(cube.getPosition().subtract(response.getMinimumTranslationVector()));
      batcher.color(Color.RED);
    }
    batcher.end();
  }
  RenderUtils.tracePolyhedron(batcher,cube,Color.GREEN);
  RenderUtils.tracePolyhedron(batcher,sphere,Color.GREEN);
  RenderUtils.tracePolyhedron(batcher,cube.getBounds(),Color.WHITE);
  RenderUtils.tracePolyhedron(batcher,sphere.getBounds(),Color.WHITE);
  hudCam.apply();
  hudFont.drawString(batcher,"String_Node_Str" + intersects,10,10);
  hudFont.drawString(batcher,"String_Node_Str" + response.isAInsideB(),10,10);
  hudFont.drawString(batcher,"String_Node_Str" + response.isBInsideA(),10,14);
  hudFont.drawString(batcher,"String_Node_Str" + response.getOverlapDistance(),10,16);
  hudFont.drawString(batcher,"String_Node_Str" + response.getOverlapAxis(),10,18);
  hudFont.drawString(batcher,"String_Node_Str" + response.getMinimumTranslationVector(),10,20);
}
Program: 96982
Project: 96982
Buggy source:
public OggReader(InputStream is){
  decodeToPCM(is);
}

Fixed version (ground truth):
/** 
 * Constructs an OGG reader to read from an InputStream.
 * @param is The InputStream to load the sound samples from.
 */
public OggReader(InputStream is){
  decodeToPCM(is);
}
Program: 96983
Project: 96983
Buggy source:
public WaveReader(String filename){
  this(FileUtils.getResource(filename));
}

Fixed version (ground truth):
/** 
 * Constructs a WaveReader that reads samples from a wave file.
 * @param filename The filename of the wav file resource.
 */
public WaveReader(String filename){
  this(FileUtils.getResource(filename));
}
Program: 96984
Project: 96984
Buggy source:
private void updateVertices(){
  clearVertices();
  final int bandPower=5;
  final int bandPoints=(int)Math.pow(2,bandPower);
  final int bandMask=bandPoints - 2;
  final int sectionsInBand=(bandPoints / 2) - 1;
  final int totalPoints=sectionsInBand * bandPoints;
  final float sectionArc=6.28f / sectionsInBand;
  final float radius=-this.radius;
  float xAngle;
  float yAngle;
  for (int i=0; i < totalPoints; i++) {
    xAngle=(float)(i & 1) + (i >> bandPower);
    yAngle=(float)((i & bandMask) >> 1) + ((i >> bandPower) * sectionsInBand);
    xAngle*=sectionArc / 2f;
    yAngle*=sectionArc * -1;
    float x=(float)(radius * Math.sin(xAngle) * Math.sin(yAngle));
    float y=(float)(radius * Math.cos(xAngle));
    float z=(float)(radius * Math.sin(xAngle) * Math.cos(yAngle));
    addVertex(new Vector3(x,y,z));
  }
}

Fixed version (ground truth):
private void updateVertices(){
  clearVertices();
  final int bandPower=6;
  final int bandPoints=(int)Math.pow(2,bandPower);
  final int bandMask=bandPoints - 2;
  final int sectionsInBand=(bandPoints / 2) - 1;
  final int totalPoints=sectionsInBand * bandPoints;
  final float sectionArc=6.28f / sectionsInBand;
  final float radius=-this.radius;
  float xAngle;
  float yAngle;
  for (int i=0; i < totalPoints; i++) {
    xAngle=(float)(i & 1) + (i >> bandPower);
    yAngle=(float)((i & bandMask) >> 1) + ((i >> bandPower) * sectionsInBand);
    xAngle*=sectionArc / 2f;
    yAngle*=sectionArc * -1;
    float x=(float)(radius * Math.sin(xAngle) * Math.sin(yAngle));
    float y=(float)(radius * Math.cos(xAngle));
    float z=(float)(radius * Math.sin(xAngle) * Math.cos(yAngle));
    addVertex(new Vector3(x,y,z));
  }
}