/** * Gets the length of the vector (2-norm) * * @param a * an Atom object * @return Square root of the sum of the squared elements */ public static final double amount(Atom a){ return Math.sqrt(scalarProduct(a,a)); }
/** * Projects a given point onto the axis of rotation * @param point * @return An atom which lies on the axis, or null if the RotationAxis is purely translational */ public Atom getProjectedPoint(Atom point) { if(rotationPos == null) { // translation only return null; } Atom localPoint = Calc.subtract(point, rotationPos); double dot = Calc.scalarProduct(localPoint, rotationAxis); Atom localProjected = Calc.scale(rotationAxis, dot); Atom projected = Calc.add(localProjected, rotationPos); return projected; }
min = max = Calc.scalarProduct(rotationAxis,atoms[0]); for(int i=1;i<atoms.length;i++) { double prod = Calc.scalarProduct(rotationAxis,atoms[i]); if(prod<min) min = prod; if(prod>max) max = prod; double uLen = Calc.scalarProduct(rotationAxis,rotationAxis);// Should be 1, but double check min/=uLen; max/=uLen; Atom centerOnAxis = Calc.scale(rotationAxis, Calc.scalarProduct(center, rotationAxis));
double dotProduct = Calc.scalarProduct(rotationAxis, translation);
double val = scalarProduct(cb,vecprod); if (val < 0.0) angl = -angl;