Spectral analysis of polygonal cavities containing a negative-index material