The shape of a mineral is a reflection of how the atoms (which are the smallest
building blocks of all substances) are arranged in a regular array which is
specific to each type of mineral.

The way in which differently sized atoms are arranged in minerals can be likened
to how you would fit tennis and soccer balls together. Clearly the tennis balls
would fit neatly in the holes between the larger soccer balls. So also in
minerals, one atom occupies the gap between others. Neighbouring atoms in
minerals are often arranged in regular patterns, with three atoms occupying the
corners of a triangle, or four at the corners of a square, or six at the corners
of a hexagon. As more atoms are transported to the site of growth these
crystals grow larger, perhaps elongated, and show triangular, cubic, or
hexagonal form. Mineralogists use the regular shapes of minerals as a means of
identifying them.

If the mineral grows, or crystallises, on the edge of an open space it is able
to build a regular crystal. On the other hand, if the mineral is growing with
lots of others, its external shape may well be irregular, with all the crystals
small and squashed together.