private Vector2 screenToWorld(Point p,Dimension size,Vector2 offset,double scale){
  Vector2 v=new Vector2();
  double x=p.x;
  double y=p.y;
  double w=size.getWidth();
  double h=size.getHeight();
  double ox=offset.x;
  double oy=offset.y;
  v.x=(x - w * 0.5) / scale - ox;
  v.y=-((y - h * 0.5) / scale + oy);
  return v;
}

private Vector2 screenToWorld ( Point p , Dimension size , Vector2 offset , double scale ) { Vector2 v = new Vector2 ( ) ; double x = p . x ; double y = p . y ; double w = size . getWidth ( ) ; double h = size . getHeight ( ) ; double ox = offset . x ; double oy = offset . y ; v . x = ( x - w * 0.5 ) / scale - ox ; v . y = - ( ( y - h * 0.5 ) / scale + oy ) ; return v ; }
converts from screen coordinates to world coordinates .
