public static void computePositions(Node node,int depth,double aoff,double awid,int maxdepth){
  double r=depth / (maxdepth - 1.);
  node.x=Math.sin(aoff + awid * .5) * r;
  node.y=Math.cos(aoff + awid * .5) * r;
  double cpos=aoff;
  double cwid=awid / node.weight;
  for (  Node c : node.children) {
    computePositions(c,depth + 1,cpos,cwid * c.weight,maxdepth);
    cpos+=cwid * c.weight;
  }
}

public static void computePositions ( Node node , int depth , double aoff , double awid , int maxdepth ) { double r = depth / ( maxdepth - 1. ) ; node . x = Math . sin ( aoff + awid * .5 ) * r ; node . y = Math . cos ( aoff + awid * .5 ) * r ; double cpos = aoff ; double cwid = awid / node . weight ; for ( Node c : node . children ) { computePositions ( c , depth + 1 , cpos , cwid * c . weight , maxdepth ) ; cpos += cwid * c . weight ; } }
compute the layout positions
