code: static boolean less(int i, int j, IAtom[] atoms, Point2d center) {
  
          Point2d a = atoms[i].getPoint2d();
          Point2d b = atoms[j].getPoint2d();
  
          if (a.x - center.x >= 0 && b.x - center.x < 0) return true;
          if (a.x - center.x < 0 && b.x - center.x >= 0) return false;
          if (a.x - center.x == 0 && b.x - center.x == 0) {
              if (a.y - center.y >= 0 || b.y - center.y >= 0) return a.y > b.y;
              return b.y > a.y;
          }
  
          // compute the cross product of vectors (center -> a) x (center -> b)
          double det = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y);
          if (det < 0) return true;
          if (det > 0) return false;
  
          // points a and b are on the same line from the center
          // check which point is closer to the center
          double d1 = (a.x - center.x) * (a.x - center.x) + (a.y - center.y) * (a.y - center.y);
          double d2 = (b.x - center.x) * (b.x - center.x) + (b.y - center.y) * (b.y - center.y);
          return d1 > d2;
      }
docs: Is index {@code i}, to the left of index {@code j} when sorting clockwise around the {@code
  centre}.
  
  @param i      an index in {@code atoms}
  @param j      an index in {@code atoms}
  @param atoms  atoms
  @param center central point
  @return atom i is before j
  @see <a href="http://stackoverflow.com/a/6989383">Sort points in clockwise order, ciamej</a>