/** * Returns the Vector that needs to be applied to shift a set of atoms to * the Centroid. * * @param atomSet * array of Atoms * @return the vector needed to shift the set of atoms to its geometric * center */ public static final Atom getCenterVector(Atom[] atomSet){ Atom centroid = getCentroid(atomSet); return getCenterVector(atomSet,centroid); }
/** * Center the atoms at the Centroid. * * @param atomSet * a set of Atoms * @return an Atom representing the Centroid of the set of atoms * @throws StructureException * */ public static final Atom[] centerAtoms(Atom[] atomSet) throws StructureException { Atom centroid = getCentroid(atomSet); return centerAtoms(atomSet, centroid); }
/** this is probably useless * * @param ca1subset * @param ca2subset * @return a double * @throws StructureException */ private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{ Atom centroid1 = Calc.getCentroid(ca1subset); Atom centroid2 = Calc.getCentroid(ca2subset); // get Average distance to centroid ... double d1 = 0; double d2 = 0; for ( int i = 0 ; i < ca1subset.length;i++){ double dd1 = Calc.getDistance(centroid1, ca1subset[i]); double dd2 = Calc.getDistance(centroid2, ca2subset[i]); d1 += dd1; d2 += dd2; } double avd1 = d1 / ca1subset.length; double avd2 = d2 / ca2subset.length; return Math.min(avd1,avd2); }
/** * Get the centroid for the set of atoms starting from position pos, length fragmentLenght * * @param ca * @param pos * @param fragmentLength * @return an Atom */ public static Atom getCenter(Atom[] ca, int pos, int fragmentLength){ Atom center = new AtomImpl(); if ( pos+fragmentLength > ca.length) { logger.info("pos ("+pos+"), fragL ("+fragmentLength +") > ca.length"+ca.length); return center; } Atom[] tmp = getFragmentNoClone(ca,pos,fragmentLength); return Calc.getCentroid(tmp); }
Atom centr1 = Calc.getCentroid(atoms1); Atom centr2 = Calc.getCentroid(atoms2); Calc.transform(centr2, transform);
return Calc.getCentroid(atoms).getCoords();