private void reflect(IntStack stack, Tuple2d begP, Tuple2d endP) { double dx = endP.x - begP.x; double dy = endP.y - begP.y; double a = (dx * dx - dy * dy) / (dx * dx + dy * dy); double b = 2 * dx * dy / (dx * dx + dy * dy); for (int i = 0; i < stack.len; i++) { reflect(atoms[stack.xs[i]].getPoint2d(), begP, a, b); } }
private void reflect(IntStack stack, Tuple2d begP, Tuple2d endP) { double dx = endP.x - begP.x; double dy = endP.y - begP.y; double a = (dx * dx - dy * dy) / (dx * dx + dy * dy); double b = 2 * dx * dy / (dx * dx + dy * dy); for (int i = 0; i < stack.len; i++) { reflect(atoms[stack.xs[i]].getPoint2d(), begP, a, b); } }
/** * Reflect all atoms (indexes) int he provided stack around the line formed * of the beg and end atoms. * * @param stack atom indexes to reflect * @param beg beg atom of a bond * @param end end atom of a bond */ private void reflect(IntStack stack, IAtom beg, IAtom end) { Point2d begP = beg.getPoint2d(); Point2d endP = end.getPoint2d(); reflect(stack, begP, endP); }
/** * Reflect all atoms (indexes) int he provided stack around the line formed * of the beg and end atoms. * * @param stack atom indexes to reflect * @param beg beg atom of a bond * @param end end atom of a bond */ private void reflect(IntStack stack, IAtom beg, IAtom end) { Point2d begP = beg.getPoint2d(); Point2d endP = end.getPoint2d(); reflect(stack, begP, endP); }
private boolean fusionPointInversion(AtomPair pair) { // not candidates for inversion // > 3 bonds if (pair.bndAt.length != 3) return false; if (bfix.contains(pair.bndAt[0]) || bfix.contains(pair.bndAt[2])) return false; // we want *!@*@*!@* if (!pair.bndAt[0].isInRing() || pair.bndAt[1].isInRing() || pair.bndAt[2].isInRing()) return false; // non-terminals if (adjList[pair.fst].length > 1 || adjList[pair.snd].length > 1) return false; IAtom fst = atoms[pair.fst]; // choose which one to invert, preffering hydrogens stackBackup.clear(); if (fst.getAtomicNumber() == 1) stackBackup.push(pair.fst); else stackBackup.push(pair.snd); reflect(stackBackup, pair.bndAt[0].getBegin(), pair.bndAt[0].getEnd()); congestion.update(stackBackup.xs, stackBackup.len); return true; }
private boolean fusionPointInversion(AtomPair pair) { // not candidates for inversion // > 3 bonds if (pair.bndAt.length != 3) return false; if (bfix.contains(pair.bndAt[0]) || bfix.contains(pair.bndAt[2])) return false; // we want *!@*@*!@* if (!pair.bndAt[0].isInRing() || pair.bndAt[1].isInRing() || pair.bndAt[2].isInRing()) return false; // non-terminals if (adjList[pair.fst].length > 1 || adjList[pair.snd].length > 1) return false; IAtom fst = atoms[pair.fst]; // choose which one to invert, preffering hydrogens stackBackup.clear(); if (fst.getAtomicNumber() == 1) stackBackup.push(pair.fst); else stackBackup.push(pair.snd); reflect(stackBackup, pair.bndAt[0].getBegin(), pair.bndAt[0].getEnd()); congestion.update(stackBackup.xs, stackBackup.len); return true; }
backupCoords(backup, stackBackup); reflect(stackBackup, new Point2d(a.x - perp.y, a.y + perp.x), new Point2d(a.x + perp.y, a.y - perp.x)); congestion.update(visited, stackBackup.xs, stackBackup.len);
reflect(stackBackup, beg, end); congestion.update(visited, stackBackup.xs, stackBackup.len);
reflect(stackBackup, beg, end); congestion.update(visited, stackBackup.xs, stackBackup.len);
backupCoords(backup, stackBackup); reflect(stackBackup, new Point2d(a.x - perp.y, a.y + perp.x), new Point2d(a.x + perp.y, a.y - perp.x)); congestion.update(visited, stackBackup.xs, stackBackup.len);