Logo Search packages:      
Sourcecode: cdk version File versions  Download package

static Point2d org::openscience::cdk::geometry::GeometryTools::get2DCenter ( Iterable< IAtom atoms ) [inline, static]

Calculates the center of the given atoms and returns it as a Point2d See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets

atomsThe vector of the given atoms
The center of the given atoms as Point2d

Definition at line 354 of file GeometryTools.java.

Referenced by get2DCenter(), getClosestBond(), org::openscience::cdk::layout::StructureDiagramGenerator::handleAliphatics(), org::openscience::cdk::layout::StructureDiagramGenerator::layoutRingSet(), org::openscience::cdk::layout::RingPlacer::placeConnectedRings(), org::openscience::cdk::layout::AtomPlacer::placeLinearChain(), org::openscience::cdk::layout::RingPlacer::placeRingSubstituents(), and translate2DCenterTo().

            double xsum = 0;
            double ysum = 0;
            int length = 0;
            for (IAtom atom : atoms) {
                  if (atom.getPoint2d() != null) {
                        xsum += atom.getPoint2d().x;
                        ysum += atom.getPoint2d().y;
            return new Point2d(xsum / (double) length, ysum / (double) length);

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index