# true length of rectangular plane from trapezoid cross-section in 3d scene

Problem Background

I'm playing with a 3d environment where i (the camera) am at the center of a sphere (both the camera and the center of the sphere are positioned at the 0,0,0 origin point) and the sphere has a 360 degree image mapped onto it like http://core0.staticworld.net/images/article/2015/08/360-degree-ricoh-theta-100609103-large.jpg

from my center perspective everything looks proper without any warping like the outside looking in perspective in the previous image. and in my sphere i have marked the boundaries of the hallway floor which yields a long trapezoidal plane. Like when you see the horizon/vanishing point for a long road.

Problem

The question is: what is the process to calculate the length of the hallway (in 3d environment units) as a rectangular plane (the true shape of the hallway) instead of the trapezoidal one that i marked for myself?

• You mean, you have a trapezoid in the sphere surface, and you need to know their equivalent size in the real world? Remember that two different circular objects will have the same solid angular area, thus looking equally from your camera. Hence i think the problem voids itself. – Brethlosze Jun 4 '17 at 16:22
• No. First, the 4 corners of the floor based on the sphere surface. The boundaries connecting the corners into a plane is 2d, not stretched against the edge of the sphere. So it's almost like a cross section but not quite. Second, I specifically said not real world sizes, but rather 3d environment sizes. So they would all be relative to each other. – stanley Jun 4 '17 at 16:27
• Does that make more sense? – stanley Jun 4 '17 at 16:29
• Hence, the solid angle should be enough for sizing everything. Or just distances over the surface of the sphere. Which is actually the same than the solid angle by a factor of $r$, the sphere radius. Oh wait, it can be equal to 1 too. Hence the solid angle is your answer. Which is not solid but just x and z angles. Well you already got it. I guess. – Brethlosze Jun 4 '17 at 16:32
• Hmm could you explain it like I'm 5? 😅 (Had to look up what a solid angle was.) I guess what I ultimately want is to take the dimensions of the hallway as represented by the 2d trapezoid plane and calculate the dimensions of the hallway without the perspective distortion. So the output would be the dimensions of a 2d rectangular plane with dimensions relative to the original trapezoid. – stanley Jun 4 '17 at 16:43

Let mess everything now. Assume you have a sphere of radius $\rho$. Two points $p_1$, $p_2$ will have the following coordinates: $$p_i=(\phi_i,\theta_i), \phi-i \in [-\pi,\pi], \theta \in [-\frac\pi2, \frac\pi2]$$ The angular distance, this is the path between them through the sphere, is then: $$\varphi=\text{acos} (\sin(\theta_1)\sin(\theta_2)+cos(\theta_1)cos(\theta_2)(\phi_1-\phi_2))\\ d=\rho \varphi$$ This line will be viewed as a $\varphi$ angle from the camera.
Hence, your trapezoid will measure ${d\over\rho_i}$ at each vertical side, when $d$ is the real world length and the $\rho_i$ are the real world distances.