Difference between revisions of "Notes:Spherical coordinates"

From Maths
Jump to: navigation, search
(Created page with "{{Note|This is in reference to [http://gamedev.stackexchange.com/questions/108667/how-to-load-a-spherical-planet-and-its-regions this question] and not a part of the site, I n...")
 
m
Line 17: Line 17:
  
 
==Going between charts==
 
==Going between charts==
 +
[[File:Transition map.JPG|thumb|Transition map {{M|\psi\circ\varphi^{-1} }} on a topological {{n|manifold}} {{M|M}}]]
 
''(see [[transition map]] - it has a good picture)''<br/>
 
''(see [[transition map]] - it has a good picture)''<br/>
 
Take two charts, {{M|\phi:U\rightarrow\mathbb{R}^n}} and {{M|\psi:V\rightarrow\mathbb{R}^n}} where we have:
 
Take two charts, {{M|\phi:U\rightarrow\mathbb{R}^n}} and {{M|\psi:V\rightarrow\mathbb{R}^n}} where we have:
Line 40: Line 41:
 
In maths we would write this as:
 
In maths we would write this as:
 
*{{M|1=t=\psi\circ\phi^{-1}:\text{Im}_\phi(U\cap V)\rightarrow\text{Im}_\psi(U\cap V)}}
 
*{{M|1=t=\psi\circ\phi^{-1}:\text{Im}_\phi(U\cap V)\rightarrow\text{Im}_\psi(U\cap V)}}
[[File:Transition map.JPG|thumb|Transition map {{M|\psi\circ\varphi}} on a topological {{n|manifold}} {{M|M}}]]
+
 
  
 
==Canonical coordinates==
 
==Canonical coordinates==
Line 48: Line 49:
  
 
==The circle==
 
==The circle==
You "need" 4 charts to cover a circle. You can do it in less, but 4 is a very natural number. Notice also it is finite. You can give every point a "coordinate" as a chart number then the coordinates in that chart. The problem is this isn't unique (as we know, charts can overlap) - we need to fix this.  
+
You "need" 4 charts to cover a circle. You can do it in less, but 4 is a very natural number. Notice also it is finite. This means we can do it on a computer!
 
+
<center>
{{Todo|Picture of circle with 4 natural charts}}
+
{| class="wikitable" border="1"
 +
|-
 +
![[Image:Charting A Circle.JPG|650px]]
 +
|-
 +
| 4 natural charts for the circle, {{M|\varphi_1,\ \varphi_2,\ \varphi_3}} and {{M|\varphi_4}}
 +
|}
 +
</center>
  
 
As you can see these are really easy coordinate charts, they're [[Projector|projections]] straight down onto a line. This makes them great to work out. Provided that your planet is a "heightmap" (that is you have a sphere where you move vertices in/out radially and don't have things like caves ''which would change the topology of your planet - beyond repair of this model if your tunnel had an exit'') this will work well.  
 
As you can see these are really easy coordinate charts, they're [[Projector|projections]] straight down onto a line. This makes them great to work out. Provided that your planet is a "heightmap" (that is you have a sphere where you move vertices in/out radially and don't have things like caves ''which would change the topology of your planet - beyond repair of this model if your tunnel had an exit'') this will work well.  

Revision as of 16:01, 23 September 2015

This is in reference to this question and not a part of the site, I needed math-markup

Manifolds

Take the Earth (the planet that we're on) - it's actually (topologically) a sphere, it's a bit bumpy but mainly a sphere, yet to someone standing on it it is rather plane-like. This was actually the subject of some dispute many years ago!

This is the basis for a topological manifold the idea is you have this "blob" but bits of it look like (chunks of) [ilmath]\mathbb{R}^n[/ilmath] if you stay in certain regions. In our case parts of the earth look like planes, so are subsets of [ilmath]\mathbb{R}^2[/ilmath] - we would say the Earth is a topological [ilmath]2[/ilmath]-manifold.

Charts and atlases

A chart should make you think of the explorers of the past, charting the oceans and such. It's a bit of paper that "chart"s a specific area. Bits of paper are bits of a plane.

Many charts make an atlas - an atlas is just a bunch of charts that cover the entire thing we're charting.

Terminology

Let [ilmath]M[/ilmath] be our manifold.

  • A chart is a function, [ilmath]\phi:U\rightarrow\mathbb{R}^n[/ilmath] where [ilmath]U[/ilmath] is some portion of our manifold, [ilmath]M[/ilmath], for example here in the UK we have something called ordinance survey maps that take the UK and map it onto a plane with grid-reference coordinates.
  • An atlas is a collection of charts, [ilmath]\{\phi_i:U_i\rightarrow\mathbb{R}^n\}_{i\in A} [/ilmath] is how we'd write this. [ilmath]A[/ilmath] is our index for a collection of charts, some set such that if we take some [ilmath]i\in A[/ilmath] (note [ilmath]\in[/ilmath] means "in" - literally, so here I am saying "for some [ilmath]i[/ilmath] in [ilmath]A[/ilmath]") we have a chart [ilmath]\phi_i:U_i\rightarrow\mathbb{R}^n[/ilmath] - for that [ilmath]i\in A[/ilmath] we have a chart, called [ilmath]\phi_i[/ilmath] that takes a chunk of the manifold, [ilmath]U_i[/ilmath] to [ilmath]\mathbb{R}^n[/ilmath].

Going between charts

Transition map [ilmath]\psi\circ\varphi^{-1} [/ilmath] on a topological [ilmath]n[/ilmath]-manifold [ilmath]M[/ilmath]

(see transition map - it has a good picture)
Take two charts, [ilmath]\phi:U\rightarrow\mathbb{R}^n[/ilmath] and [ilmath]\psi:V\rightarrow\mathbb{R}^n[/ilmath] where we have:

  • [ilmath]U\cap V\ne\emptyset[/ilmath] ([ilmath]\cap[/ilmath] denotes intersection of sets, [ilmath]x\in A\cap B\iff x\in A\text{ and }x\in B[/ilmath], [ilmath]\emptyset[/ilmath] denotes the empty set, so here we are saying "there are things in both [ilmath]U[/ilmath] and [ilmath]V[/ilmath])

Then for an [ilmath]x\in U\cap V[/ilmath] we have two sets of "coordinates", we have:

  • [ilmath]\phi(x)[/ilmath] - which gives us some coordinates according to [ilmath]\phi[/ilmath]
  • [ilmath]\psi(x)[/ilmath] - which gives us some coordinates according to [ilmath]\psi[/ilmath]

That is this point [ilmath]x[/ilmath] has differing coordinates, depending on how we view it.

In this case we can define a transition map, [ilmath]t:\mathbb{R}^n\rightarrow\mathbb{R}^n[/ilmath] that takes coordinates in [ilmath]\phi[/ilmath] to their coordinates in [ilmath]\psi[/ilmath]. It is easy to define.

Here's a picture (on the right)

  • [ilmath]\text{Im}_\phi(U\cap V)[/ilmath] is all the "image" of [ilmath]U\cap V[/ilmath] under [ilmath]\phi[/ilmath] and is the shaded bit on the bottom left. These are what [ilmath]U\cap V[/ilmath] maps to uder [ilmath]\phi[/ilmath]

To go from [ilmath]\text{Im}_\phi(U\cap V)[/ilmath] to the other chart we must go back to the manifold, via [ilmath]\phi^{-1} [/ilmath] - this is the inverse of [ilmath]\phi[/ilmath].

  • If [ilmath]\phi:U\rightarrow\mathbb{R}^n[/ilmath] then [ilmath]\phi^{-1}:\mathbb{R}^n\rightarrow U[/ilmath] where [ilmath]\phi^{-1}(y)=\{\text{all the things such that }\phi(\text{thing})=y\}[/ilmath]

So we take [ilmath]x\in\text{Im}_\phi(U\cap V)[/ilmath] - some point in the [ilmath]\mathbb{R}^n[/ilmath] of our [ilmath]\phi[/ilmath] chart and we:

  1. Go back onto the manifold, by doing [ilmath]\phi^{-1}(x)[/ilmath] if we call this [ilmath]y[/ilmath] then [ilmath]\phi(y)=x[/ilmath] remember
  2. We now take [ilmath]\phi^{-1}(x)[/ilmath] (which is on [ilmath]M[/ilmath] remember) to the coordinates in the other chart, [ilmath]\psi[/ilmath]
    • By doing [ilmath]\psi(\phi^{-1}(x))[/ilmath]

In maths we would write this as:

  • [ilmath]t=\psi\circ\phi^{-1}:\text{Im}_\phi(U\cap V)\rightarrow\text{Im}_\psi(U\cap V)[/ilmath]


Canonical coordinates

We will assign each point on the manifold a "canonical coordinate" - these are coordinates of the form [ilmath](i,x)[/ilmath] where a point [ilmath]p[/ilmath] on the manifold has coordinate [ilmath]x=\phi_i(p)[/ilmath] - so the [ilmath]i[/ilmath] is the chart identifier and the [ilmath]x[/ilmath] is the vector of the point in the chart.

As you know charts can overlap, what we'll do is centre the charts and define a canonical coordinate as having a "cut off" point. once we go passed this point we consider it in a different chart. I will do this in the circle now.

The circle

You "need" 4 charts to cover a circle. You can do it in less, but 4 is a very natural number. Notice also it is finite. This means we can do it on a computer!

Charting A Circle.JPG
4 natural charts for the circle, [ilmath]\varphi_1,\ \varphi_2,\ \varphi_3[/ilmath] and [ilmath]\varphi_4[/ilmath]

As you can see these are really easy coordinate charts, they're projections straight down onto a line. This makes them great to work out. Provided that your planet is a "heightmap" (that is you have a sphere where you move vertices in/out radially and don't have things like caves which would change the topology of your planet - beyond repair of this model if your tunnel had an exit) this will work well.

My location on a circle

Given a point [ilmath]p[/ilmath] on a circle we will assign it a "natural" or "canonical" coordinate of the form [ilmath](i,x)[/ilmath] where [ilmath]i[/ilmath] is between 0 and 3 (this is the chart number) and [ilmath]x[/ilmath] is the coordinate in that chart.

Now you can say "there is a factory at [ilmath](1,0.3)[/ilmath] and know EXACTLY where that factory is. These coordinates don't smush together and stay "fairly" regular. You cannot cover a circle nor a sphere in 1 chart (however the bit you cannot cover has measure 0 - so when integrating in spherical/polar coordinates you can ignore it)

Equations

Given a point [ilmath](x,y)[/ilmath] on a circle about the origin, where [ilmath]y>0[/ilmath] and [ilmath]x[/ilmath] is between [ilmath]-\frac{\sqrt{2} }{2} [/ilmath] and [ilmath]\frac{\sqrt{2} }{2} [/ilmath] (thus in the domain of the zeroth chart) the coordinate of this is [ilmath](0,x)[/ilmath] - this "projects" the coordinate straight down, because the circle is curved this isn't quite uniform.


TODO: Picture of non-uniform downwards projection



It would be more uniform to have a different charting scheme where we use angles.



TODO: Charting with angles picture



We have now charted the circle.

Why not just use the angles (and radius)?

In a circle to use angles we must have stuff in a range, [ilmath][0,360)[/ilmath] this denotes the set [ilmath]\{x[/ilmath] the problem is that if you're at [ilmath]0[/ilmath] you suddenly jump to 360, you cannot go "backwards" smoothly (you suddenly jump), you also cannot go smoothly back around to zero when you're by [ilmath]360[/ilmath] - but this is an open end of the interval, which means for an [ilmath]x\in(0,360)[/ilmath] - any [ilmath]x[/ilmath] you like - there is a small amount you can go either way. Always. If you're at [ilmath]359.98[/ilmath] you can still go [ilmath]0.01[/ilmath] in either direction without jumping.

Another problem is that you'd use [ilmath]\text{Arctan} [/ilmath] to get the angles, this'll have 2 discontinuities, when [ilmath]y[/ilmath] = 0 (if you define vertically up as an angle of [ilmath]0[/ilmath])

Also it'll not be able to distinguish which "quarter" you're in, as [ilmath]\frac{x}{y}=\frac{-x}{-y}[/ilmath] thus the top right and bottom left have the same angle.

With spheres this problem becomes a little complex. Usually a point has 2 angles, an "up down" angle and a "around" angle. When you're at a pole any "around" angle will work. So you cannot move locally in the coordinates either, they're also far from unique. Add floating point numbers in there and this becomes a real problem.

Using nice charts (like we do) fixes all of this.

The sphere

We will use 6 charts.



TODO: picture is worth a thousand words



Like a cube-map, we shall assign cut-offs by giving each chart [ilmath]90^\circ[/ilmath] to "chart", notice that the charts (both the angle ones and the straight down projections) are able to cover a range of [ilmath]180^\circ[/ilmath] - this means we have plenty of overlap and makes it easy to move between them - in fact you can move an angle of [ilmath]< 45^\circ[/ilmath] without leaving the chart ALWAYS. If you use the angular ones the chunks will also all be the same size, so you can talk of regions of so many square kilometers about any point in our canonical coordinates without problem. This is a large chunk of the planet's surface.

The charts


TODO: Give them explicitly