public double getDiagonalLengthSquared() { return minPoint.distanceSquared(maxPoint); }
private Point2d[] findStartPoint(Point2d startPoint, Point2d[] rectangleContur) { int minI = 0; double minDist = startPoint.distanceSquared(rectangleContur[0]); for (int i = 1; i < 4; i++) { double distance = startPoint.distanceSquared(rectangleContur[i]); if (distance < minDist) { minDist = distance; minI = i; } } return swapRectangle(rectangleContur, minI); }
private List<DistAtom> findMergeCandidates(IAtomContainer set, IAtom atom ) { List<DistAtom> candidates = new ArrayList<DistAtom>(); for(IAtom candidate:set.atoms()) { double disSquare = candidate.getPoint2d().distanceSquared( atom.getPoint2d() ); candidates.add(new DistAtom(candidate,disSquare)); } return candidates; }
private Point2d[] findOrientation(RoofOrientation orientation, Point2d[] pRectangleContur) { if (orientation == null) { return pRectangleContur; } Point2d p1 = pRectangleContur[0]; Point2d p2 = pRectangleContur[1]; Point2d p3 = pRectangleContur[2]; boolean along = p1.distanceSquared(p2) > p2.distanceSquared(p3); if (RoofOrientation.along.equals(orientation)) { if (!along) { return swapRectangle(pRectangleContur, 1); } } else if (RoofOrientation.across.equals(orientation)) { if (along) { return swapRectangle(pRectangleContur, 1); } } return pRectangleContur; }
Point2d pointTwo = footstepData.predictedContactPoints.get(i); if (!(pointOne.distanceSquared(pointTwo) < 1e-7)) contactPointsEqual = false;
public IAtom getClosestAtom(Point2d worldCoord) { IAtom closestAtom = null; double closestDistanceSQ = Double.MAX_VALUE; for (IAtomContainer atomContainer : ChemModelManipulator .getAllAtomContainers(chemModel)) { for (IAtom atom : atomContainer.atoms()) { if (atom.getPoint2d() != null) { double distanceSQ = atom.getPoint2d().distanceSquared( worldCoord); if (distanceSQ < closestDistanceSQ) { closestAtom = atom; closestDistanceSQ = distanceSQ; } } } } return closestAtom; }
public IBond getClosestBond(Point2d worldCoord) { IBond closestBond = null; double closestDistanceSQ = Double.MAX_VALUE; for (IAtomContainer atomContainer : ChemModelManipulator .getAllAtomContainers(chemModel)) { for (IBond bond : atomContainer.bonds()) { boolean hasCenter = true; for (IAtom atom : bond.atoms()) hasCenter = hasCenter && (atom.getPoint2d() != null); if (hasCenter) { double distanceSQ = bond.get2DCenter().distanceSquared( worldCoord); if (distanceSQ < closestDistanceSQ) { closestBond = bond; closestDistanceSQ = distanceSQ; } } } } return closestBond; }
private IBond getClosestSelBond(Point2d worldCoord) { IBond closestBond = null; IChemObjectSelection sel = chemModelRelay.getRenderer().getRenderer2DModel().getSelection(); double closestDistanceSQ = Double.MAX_VALUE; for (IBond bond : sel.elements(IBond.class)) { if (bond.get2DCenter() != null) { double distanceSQ = bond.get2DCenter().distanceSquared( worldCoord); if (distanceSQ < closestDistanceSQ) { closestBond = bond; closestDistanceSQ = distanceSQ; } } } return closestBond; }
private IAtom getClosestSelAtom(Point2d worldCoord) { IAtom closestAtom = null; IChemObjectSelection sel = chemModelRelay.getRenderer().getRenderer2DModel().getSelection(); double closestDistanceSQ = Double.MAX_VALUE; for (IAtom atom : sel.elements(IAtom.class)) { if (atom.getPoint2d() != null) { double distanceSQ = atom.getPoint2d().distanceSquared( worldCoord); if (distanceSQ < closestDistanceSQ) { closestAtom = atom; closestDistanceSQ = distanceSQ; } } } return closestAtom; }
Point2d pointTwo = footstepData.predictedContactPoints.get(i); if (!(pointOne.distanceSquared(pointTwo) < 1e-7)) contactPointsEqual = false;