public Point2D calcCenter(final Point2D src,final Point2D tar){
  double sourceX=src.getX();
  double sourceY=src.getY();
  double targetX=tar.getX();
  double targetY=tar.getY();
  double x=Math.abs(sourceX - targetX);
  double y=Math.abs(sourceY - targetY);
  double alpha=Math.atan(y / x);
  double weightX=0;
  double weightY=0;
  int neuronOffset=NeuronNode.getDIAMETER() / 2;
  if (sourceX < targetX) {
    weightX=targetX - (neuronOffset * Math.cos(alpha));
  }
 else {
    weightX=targetX + (neuronOffset * Math.cos(alpha));
  }
  if (sourceY < targetY) {
    weightY=targetY - (neuronOffset * Math.sin(alpha));
  }
 else {
    weightY=targetY + (neuronOffset * Math.sin(alpha));
  }
  return new Point2D.Double(weightX,weightY);
}

public Point2D calcCenter ( final Point2D src , final Point2D tar ) { double sourceX = src . getX ( ) ; double sourceY = src . getY ( ) ; double targetX = tar . getX ( ) ; double targetY = tar . getY ( ) ; double x = Math . abs ( sourceX - targetX ) ; double y = Math . abs ( sourceY - targetY ) ; double alpha = Math . atan ( y / x ) ; double weightX = 0 ; double weightY = 0 ; int neuronOffset = NeuronNode . getDIAMETER ( ) / 2 ; if ( sourceX < targetX ) { weightX = targetX - ( neuronOffset * Math . cos ( alpha ) ) ; } else { weightX = targetX + ( neuronOffset * Math . cos ( alpha ) ) ; } if ( sourceY < targetY ) { weightY = targetY - ( neuronOffset * Math . sin ( alpha ) ) ; } else { weightY = targetY + ( neuronOffset * Math . sin ( alpha ) ) ; } return new Point2D . Double ( weightX , weightY ) ; }
calculates the position of the synapse circle based on the positions of the source and target neuronnodes .
