Generation of a powder pattern from a 2D single crystal pattern

This animation takes a square, 2D array of diffraction maxima (h and k Miller indices) and rotates them a full 360o around the (000) direct-beam peak, sweeping out arcs as they move. Each diffraction spot has an intensity that is related to the magnitude of the scattering vector Q. This is a simplification, of course, but represents the general rule that the atomic form factors decrease with Q, although the structure factors can fluctuate. Note that some peaks have three other equivalent peaks, such as the (0h) set or the (hh) set, while others have seven other equivalents, such as the (hk) sets for which h k and neither h nor k = 0. This multiplicity results in the final powder plot in red having two sets, each with its own envelope of intensities, one with multiplicity M = 4 and the other twice as intense, with M = 8. There is one exception with higher intensity - this is because the (50) peaks (M = 4) and the (34) peaks (M = 8) perfectly overlap on account of 32 + 42 = 52, in other words, they have Q-vectors with the same magnitude.