A New Algorithm for the Modal Analysis of 3-D Arbitrarily Shaped Resonant Cavities