public static Collection<Quaternion> generateSymmetryGroup3D(
      final List<Quaternion> generators) {
    int newElems = 0;
    Set <Quaternion> group = new HashSet<Quaternion>(generators);
    Set<Quaternion> newGroupelem = new HashSet<>();
    Quaternion z;
    do {
      newElems = 0;
      for (Quaternion x : group) {
        for (Quaternion y : group) {
          z = x.mult(y);
          if(!group.contains(z) && !newGroupelem.contains(z)){
            newGroupelem.add(z);
            newElems++;
          }
        }
      }
      for (Quaternion g : newGroupelem) {
        group.add(g);
      }
      newGroupelem.clear();
    }
    while (newElems != 0);
    return group;
  }