This content originally appeared on DEV Community and was authored by ccarcaci
This article is the first of a series that treat math topics.
I’ve decided to write some articles reporting interesting exercises and demonstrations that are difficult to find in the web.
The stereographic equations demonstration in this article is a good example. For example, the Wikipedia page about Stereographic projection doesn’t report the step-by-step process.
I’m quite positive that such demonstration could be found in math books.
Author background
My background on math is limited to what I did during my computer science degree. I’m not an expert, and I’m not an expert on graphical projection.
So, any comment, suggestion, error catch is welcome and encouraged.
The problem
The context is described in the image above. A sphere has its center in the axis origin. The horizontal plane including the origin offers the projecting surface. The projection is made by the function that associates a point onto the sphere with a point on the plane that is the result of the intersection between the plane and the segment between the North pole and the point into the sphere.
In formula:
For the sake of making the math simple, the sphere is the unit radius sphere and is centered in the origin.
Considering the perspective of plane Considering the perspective of plane x1x3x_1x_3x1x3 :
Knowing the coordinates of one point in the sphere x‾\underline{x}x and knowing that y‾\underline{y}y will be on the segment r⃗\vec{r}r connecting x‾\underline{x}x and NNN , it is possible to write the following formulas:
The reason is simple, the segment linking underlinexunderline{x}underlinex and r⃗\vec{r}r intersect x3x_3x3 axis in NNN where q=1q=1q=1 and the angular coefficient is:
The same reasoning could be done with the plane x2x3x_2x_3x2x3 :
Now, the goal is to find the coordinates of y‾\underline{y}y , and this could be done by reversing the r⃗\vec{r}r and t⃗\vec{t}t formulas:
Inverse formula
Now, the challenge begin, find the inverse formula of this projection.
In word: given a point in the plane, find the point on the sphere.
In world: given a point in a map, find the real point in the world.
To find the inverse formula the sphere formula is needed, alongside the equations that represents the segment linking the North pole to the point in the map y‾\underline{y}y .
By looking the plane x1x2x_1x_2x1x2 the North pole is projected over the origin and the equation that connect the North pole with y‾\underline{y}y is:
By looking the plane x1x3x_1x_3x1x3 the segment connecting the North pole with y‾\underline{y}y has equation:
The work evolves around the equations:
The equation for SSS could be rewritten as:
Then:
This equation has 2 solutions:
The same is valid for x2x_2x2 :
Last, x3x_3x3 is:
This content originally appeared on DEV Community and was authored by ccarcaci