Program: 7645
Project: 7645
Buggy source:
@Override protected void execAction3D(THMotionEvent e){
  Actionable<DLAction> a=null;
  if (e instanceof DOF1Event)   a=((DOF1Event)e).getAction();
  if (e instanceof DOF2Event)   a=((DOF2Event)e).getAction();
  if (e instanceof DOF3Event)   a=((DOF3Event)e).getAction();
  if (e instanceof DOF6Event)   a=((DOF6Event)e).getAction();
  if (a == null)   return;
  DLAction id=a.action();
  DOF2Event event;
  DOF6Event event6;
  Vec t=new Vec();
  Quat q=new Quat();
switch (id) {
case ZOOM:
{
      float wheelSensitivityCoef=8E-4f;
      float coef=0;
      Vec trans=new Vec();
      if (e instanceof DOF1Event) {
        coef=Math.max(Math.abs((coordinatesOf(scene.camera().arcballReferencePoint())).vec[2] * magnitude().z()),0.2f * scene.camera().sceneRadius());
        trans=new Vec(0.0f,0.0f,coef * ((DOF1Event)e).getX() * -wheelSensitivity()* wheelSensitivityCoef);
      }
 else {
        event=(DOF2Event)e;
        coef=Math.max(Math.abs((coordinatesOf(scene.camera().arcballReferencePoint())).vec[2] * magnitude().z()),0.2f * scene.camera().sceneRadius());
        trans=new Vec(0.0f,0.0f,-coef * ((int)(event.getY() - event.getPrevY())) / scene.camera().screenHeight());
      }
      Vec mag=magnitude();
      trans.div(mag);
      translate(inverseTransformOf(trans));
      break;
    }
case ROTATE:
{
    event=(DOF2Event)e;
    Vec trans=scene.camera().projectedCoordinatesOf(arcballReferencePoint());
    Quat rot=deformedBallQuaternion(event,trans.vec[0],trans.vec[1],scene.camera());
    setSpinningQuaternion(rot);
    startSpinning(event);
    break;
  }
case TRANSLATE:
{
  event=(DOF2Event)e;
  Point delta=new Point(-event.getDX(),scene.isRightHanded() ? -event.getDY() : event.getDY());
  Vec trans=new Vec((int)delta.x,(int)-delta.y,0.0f);
switch (scene.camera().type()) {
case PERSPECTIVE:
    trans.mult(2.0f * (float)Math.tan(scene.camera().fieldOfView() / 2.0f) * Math.abs(coordinatesOf(arcballReferencePoint()).vec[2] * magnitude().z()) / scene.camera().screenHeight());
  break;
case ORTHOGRAPHIC:
float[] wh=scene.camera().getOrthoWidthHeight();
trans.vec[0]*=2.0f * wh[0] / scene.camera().screenWidth();
trans.vec[1]*=2.0f * wh[1] / scene.camera().screenHeight();
break;
}
translate(inverseTransformOf(Vec.mult(trans,translationSensitivity()),false));
break;
}
case GOOGLE_EARTH:
event6=(DOF6Event)e;
float magic=0.01f;
t=Vec.mult(position(),-event6.getZ() * (magic));
translate(t);
q.fromEulerAngles(-event6.getY() * (magic),event6.getX() * (magic),0);
rotateAroundPoint(q,scene.camera().arcballReferencePoint());
q.fromEulerAngles(0,0,event6.yaw());
rotateAroundPoint(q,scene.camera().arcballReferencePoint());
q.fromEulerAngles(-event6.roll(),0,0);
rotate(q);
break;
case NATURAL:
event6=(DOF6Event)e;
translate(localInverseTransformOf(new Vec(event6.getX(),event6.getY(),-event6.getZ()),false));
q.fromEulerAngles(-event6.roll(),-event6.pitch(),event6.yaw());
rotate(q);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override protected void execAction3D(THMotionEvent e){
  Actionable<DLAction> a=null;
  if (e instanceof GenericDOF1Event)   a=(DOF_1Action)((GenericDOF1Event<?>)e).getAction();
  if (e instanceof GenericDOF2Event)   a=(DOF_2Action)((GenericDOF2Event<?>)e).getAction();
  if (e instanceof GenericDOF3Event)   a=(DOF_3Action)((GenericDOF3Event<?>)e).getAction();
  if (e instanceof GenericDOF6Event)   a=(DOF_6Action)((GenericDOF6Event<?>)e).getAction();
  if (a == null)   return;
  DLAction id=a.action();
  GenericDOF2Event<?> event;
  GenericDOF6Event<?> event6;
  Vec t=new Vec();
  Quat q=new Quat();
switch (id) {
case ZOOM:
{
      float wheelSensitivityCoef=8E-4f;
      float coef=0;
      Vec trans=new Vec();
      if (e instanceof GenericDOF1Event) {
        coef=Math.max(Math.abs((coordinatesOf(scene.camera().arcballReferencePoint())).vec[2] * magnitude().z()),0.2f * scene.camera().sceneRadius());
        trans=new Vec(0.0f,0.0f,coef * ((GenericDOF1Event<?>)e).getX() * -wheelSensitivity()* wheelSensitivityCoef);
      }
 else {
        event=(GenericDOF2Event<?>)e;
        coef=Math.max(Math.abs((coordinatesOf(scene.camera().arcballReferencePoint())).vec[2] * magnitude().z()),0.2f * scene.camera().sceneRadius());
        trans=new Vec(0.0f,0.0f,-coef * ((int)(event.getY() - event.getPrevY())) / scene.camera().screenHeight());
      }
      Vec mag=magnitude();
      trans.div(mag);
      translate(inverseTransformOf(trans));
      break;
    }
case ROTATE:
{
    event=(GenericDOF2Event<?>)e;
    Vec trans=scene.camera().projectedCoordinatesOf(arcballReferencePoint());
    Quat rot=deformedBallQuaternion(event,trans.vec[0],trans.vec[1],scene.camera());
    setSpinningQuaternion(rot);
    startSpinning(event);
    break;
  }
case TRANSLATE:
{
  event=(GenericDOF2Event<?>)e;
  Point delta=new Point(-event.getDX(),scene.isRightHanded() ? -event.getDY() : event.getDY());
  Vec trans=new Vec((int)delta.x,(int)-delta.y,0.0f);
switch (scene.camera().type()) {
case PERSPECTIVE:
    trans.mult(2.0f * (float)Math.tan(scene.camera().fieldOfView() / 2.0f) * Math.abs(coordinatesOf(arcballReferencePoint()).vec[2] * magnitude().z()) / scene.camera().screenHeight());
  break;
case ORTHOGRAPHIC:
float[] wh=scene.camera().getOrthoWidthHeight();
trans.vec[0]*=2.0f * wh[0] / scene.camera().screenWidth();
trans.vec[1]*=2.0f * wh[1] / scene.camera().screenHeight();
break;
}
translate(inverseTransformOf(Vec.mult(trans,translationSensitivity()),false));
break;
}
case GOOGLE_EARTH:
event6=(GenericDOF6Event<?>)e;
float magic=0.01f;
t=Vec.mult(position(),-event6.getZ() * (magic));
translate(t);
q.fromEulerAngles(-event6.getY() * (magic),event6.getX() * (magic),0);
rotateAroundPoint(q,scene.camera().arcballReferencePoint());
q.fromEulerAngles(0,0,event6.yaw());
rotateAroundPoint(q,scene.camera().arcballReferencePoint());
q.fromEulerAngles(-event6.roll(),0,0);
rotate(q);
break;
case NATURAL:
event6=(GenericDOF6Event<?>)e;
translate(localInverseTransformOf(new Vec(event6.getX(),event6.getY(),-event6.getZ()),false));
q.fromEulerAngles(-event6.roll(),-event6.pitch(),event6.yaw());
rotate(q);
break;
default :
break;
}
}