class GeometryTools {

    public static int getBestAlignmentForLabelXY(IAtomContainer container, IAtom atom) {
        double overallDiffX = 0;
        double overallDiffY = 0;
        for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) {
            overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x;
            overallDiffY += connectedAtom.getPoint2d().y - atom.getPoint2d().y;
        }
        if (Math.abs(overallDiffY) > Math.abs(overallDiffX)) {
            if (overallDiffY < 0)
                return 2;
            else
                return -2;
        } else {
            if (overallDiffX <= 0)
                return 1;
            else
                return -1;
        }
    }

}