void precision()
 {

  if (index[2]<0 || thumbTip<0) return ;
  
  if (HV.DLEV>0) System.out.println("Planning precision...");
  lastPlan=PRECISION;
  GRASP_TH=50; BASERATE=0.04; RATE_TH=0.25;
  resetAvoidance();
  Plane[] PL=new Plane[6];
  Point3d[] PN=new Point3d[6];
  Point3d handdir;
  int PNc=0;
  
  setPlaneProperties();

  target=new Point3d[3];  // target angles to be achived

  tIc=0;                  //  the joints that corresponds to target
  tIndex[tIc++]=thumbTip;
  tIndex[tIc++]=index[2];
  tIndex[tIc++]=wrist;
  Segment thumb_seg=hand.seg[thumbTip];
  Segment index_seg=hand.seg[index[2]];
  Segment wrist_seg=hand.seg[wrist];
  Point3d ORG=VA.add(root.limb_pos,root.joint_pos);
  VA._scale(ORG,0.5);
  ORG=objectCenter;
  Point3d AXE=root.joint_axis;

  HV.self.toggleTrace();
  Mars.clearComets();
 
  Point3d opposition;
  if (ORG.x<0) opposition=new Point3d(0,0,1);
  else opposition=new Point3d(1,0,0);
  VA._normalize(opposition);
  //-->Mars.addComet(ORG,VA.scale(opposition,150),1);

  PNc=lineIntersection(ORG, opposition, PL, PN);
//    if (PNc==0) {
//        ORG.x += (Math.random()-0.5)*0.1;
//        ORG.y += (Math.random()-0.5)*0.1;
//        ORG.z += (Math.random()-0.5)*0.1;
//        PNc=lineIntersection(ORG, opposition, PL, PN);
//    }
  PNc=lineIntersection(PN[0].duplicate(), PL[0].normal, PL, PN);
 
  /*
  if (VA.dist(PN[0],PN[1])>100) 
      { opposition=new Point3d(0,1,0);
  VA._normalize(opposition);
  PNc=lineIntersection(ORG, opposition, PL, PN);
  PNc=lineIntersection(PN[0].duplicate(), PL[0].normal, PL, PN);
      }
*/
  Point3d _dP=VA.subtract(PN[0],PN[1]);
  Point3d dP =VA.subtract(PN[1],PN[0]);
  Point3d dF =VA.subtract(index_seg.limb_pos , thumb_seg.limb_pos);


  Point3d ppp; Plane pppl;
  if (ORG.x<0  && PN[0].z>PN[1].z  ||
      ORG.x>=0 && PN[0].x>PN[1].x)
       { ppp =PN[0]; PN[0]=PN[1]; PN[1]=ppp;
         pppl=PL[0]; PL[0]=PL[1]; PL[1]=pppl;
       }

  VA._resize(PN[0],PN[1],1.4);
  lastopposition=VA.subtract(PN[0],PN[1]);
  VA._normalize(lastopposition);

// wr is the wrist offset from the center.
/*
  Point3d wr=VA.cross(AXE,dP);
  VA._normalize(wr);
  VA._scale(wr,250);
*/
  dP =VA.subtract(PN[1],PN[0]);
  handdir=VA.subtract(hand.wristx.limb_pos,PN[0]);
  Point3d t1=VA.cross(handdir,dP);
  Point3d wr=VA.cross(dP,t1);
  VA._normalize(wr);
  VA._scale(wr,250);
  PN[2]=VA.add(wr,VA.center(PN[0],PN[1]));
  ///Mars.addComet(VA.center(PN[0],PN[1]), PN[2],4);

  target=PN;

  //Mars.addComet(target[0],target[1],10);
  objsize=VA.dist(target[0],target[1]);
  HV.self.toggleTrace();
  HV.cv.refreshDisplay();
 }