Suppose you have a sphere of radius R centered in the origin: $$x^2 + y^2 + z^2 = R^2$$ and through this sphere, completely centered in the origin passes a rectangular parallepiped with dimensions: $$2l*2l*3R$$ (I don't know how to provide a visual representation for that, but imagine two lateral sides being squares with sides $2l$ and the other two lateral sides being rectangles. The length of those rectangles is bigger that $2R$ so it completely passes through the sphere.)
We also suppose that $$R<\sqrt{2}l$$ meaning the square does not englobe the whole sphere. I want to calculate the length of the trace left by the rectangular parallepiped on the surface of the sphere.
I tried: $$L_{c} = \int_{C} \mathbf{ds} $$ In polar coordinates and considering the symmetry of the problem, for $x,y,z>0$ I found: $$\mathbf{s}(\theta) = lcos(\theta)\mathbf{e}_{r} + \sqrt{R^{2} - l^{2}(cos(\theta))^{2}}\mathbf{e}_{z}, 0\le\theta\le\pi/4$$ which corresponds to the trace left by just one side of the part of the square that's in the x, y, z > 0 region. $$\mathbf{s}'(\theta) = -lsin(\theta)\mathbf{e}_{r} + lcos(\theta)\mathbf{e}_{\theta} + \frac{l^{2}sin(2\theta)} {2\sqrt{R^{2} - l^{2}cos^{2}(\theta)}}\mathbf{e}_{z}$$ $$\left|\mathbf{s}(\theta)\right| = l\sqrt{\frac{1 + l^2sin^{2}(2\theta)}{4(R^{2} - l^{2}cos^{2}(\theta))}}$$ And so finally: $$\frac{1}{8}L_{c} = 2\int_{0}^{\pi/4}\left|\mathbf{s}(\theta)\right|d\theta$$
However the resulting integral seems too difficult to compute and hving an idea of the result I should get, I think my description of the curve ( the trace left on the sphere ) was wrong. Could someone point out where I went wrong or provide an alternative parametric description of the trace?
Hint. Work out the curve segments individually.