class GeometryTools {

    public static double getLength2D(IBond bond) {
        if (bond.getBegin() == null || bond.getEnd() == null) {
            return 0.0;
        }
        Point2d point1 = bond.getBegin().getPoint2d();
        Point2d point2 = bond.getEnd().getPoint2d();
        if (point1 == null || point2 == null) {
            return 0.0;
        }
        return point1.distance(point2);
    }

}