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.


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?

  • $\begingroup$ 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. $\endgroup$ – Brethlosze Jun 4 '17 at 16:22
  • $\begingroup$ 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. $\endgroup$ – stanley Jun 4 '17 at 16:27
  • $\begingroup$ Does that make more sense? $\endgroup$ – stanley Jun 4 '17 at 16:29
  • $\begingroup$ 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. $\endgroup$ – Brethlosze Jun 4 '17 at 16:32
  • $\begingroup$ 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. $\endgroup$ – stanley Jun 4 '17 at 16:43

This answer is my own comment space.

Aw well.. you are 5 then... you have a line on the surface of the sphere, then you have a second and a third, they all sum as normally. And if you have a cross made by an horizontal line and a vertical line, and you move it over the surface, then whenever you see, you will see a cross, not another shape. So if you see a trapezoid over the surface, if you move it everywhere, you will still be viewing the same trapezoid!

Perspective is a different animal. You don't want to mess with that, yet. By now, you only have a single sphere surface, and rectangles over it.

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.

  • $\begingroup$ But I'm most interested in the perspective part of this question. Given a line that is drawn from the center of of the sphere that is orthogonal to the trapezoid, the length of the line parallel to the trapezoid base and intersecting that orthogonal line from the sphere center should be the "true" width of the hallway. But that still leaves the height to be determined. $\endgroup$ – stanley Jun 4 '17 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.