Is it possible to solve for theta in this multivariable equation?

Question: Given the equation $$c^2=a^2+(\frac{pq}{\sqrt{q^2\sin^2{\theta}+p^2\c os^2{\theta}}})^2-2a\frac{pq}{\sqrt{q^2\sin^2{\theta}+p^2\cos^2{\the ta}}}\cos{\theta},$$
is it possible to solve for $\theta$ in terms of $a,c,p,$ and $q$?

Original Problem: I am attempting to develop an algorithm to solve an extension of a spherical codes problem.This image:
shows a partial cutaway of a spherical codes solution (a center sphere with as many smaller spheres packed onto it as possible, cut away to show the inner sphere).

I'd like to extend this problem to ellipsoids, so essentially to take an ellipsoid with given dimensions and pack as many spheres of another given dimension on its surface as possible. The equation above is a central part of my solution to this problem, and is derived from the law of cosines with $\theta$ as the opposite angle to side $c$ and the side $b$ substituted by the large fraction ($\frac{pq}{...}$).