public void rotateSelectedAtomsXYBy(Matrix3f transform, BitSet bs, float dx, float dy) {
		if (rotationMatrix == null)
			rotationMatrix = new Matrix3f();
		if (tempMatrix1 == null)
			tempMatrix1 = new Matrix3f();
		if (tempMatrix2 == null)
			tempMatrix2 = new Matrix3f();
		if (tempMatrix3 == null)
			tempMatrix3 = new Matrix3f();
		if (tempPoint3f == null)
			tempPoint3f = new Point3f();
		Point3f center = getCenterOfSelectedAtoms(bs);
		// *watch* the order of matrix multiplications: first transform the atomic coordinates into the current
		// view space, and then apply rotX and rotY, and then transform back to the model space.
		tempMatrix3.invert(transform);
		tempMatrix1.rotX(dy * radiansPerDegree);
		tempMatrix2.rotY(dx * radiansPerDegree);
		rotationMatrix.set(tempMatrix3);
		rotationMatrix.mul(tempMatrix1);
		rotationMatrix.mul(tempMatrix2);
		rotationMatrix.mul(transform);
		for (int i = 0; i < iAtom; i++) {
			if (bs.get(i)) {
				tempPoint3f.x = atom[i].rx;
				tempPoint3f.y = atom[i].ry;
				tempPoint3f.z = atom[i].rz;
				rotationMatrix.transform(tempPoint3f);
				atom[i].setLocation(tempPoint3f);
			}
		}
		translateSelectedAtomsTo(bs, center);
	}