PDA

View Full Version : Calling BruceZ


Borodog
11-09-2006, 08:39 PM
Or another mathemagician.

Presume you have a regular spherical coordinate grid of points located on a surface of constant radius, i.e. a regular grid of points along intersecting lines of fixed longitude and lattitude. Coordinates are then theta_i,j (polar coordinate) and phi_i,j (azimuthal coordinate). Take i to be the polar index and j to be the azimuthal index.

Each lattice point is then one corner of a rectilinear zone within the grid. Associated with each zone is a known value of, for example, the average density within the zone. Presume some thickness, and the area and density in the zone would allow one to calculate the total mass of each grid zone.

Now consider another spherical coordinate grid, rotated relative to the first (by 90 degrees of polar angle), but otherwise identically constructed. What I need is a way to conservatively map the densities from the first grid onto the second. By conservatively I mean that the second grid must have exactly the same total mass as the first.

I cannot do something as simple as, for example, simply interpolating the density at the new grid points from the nearest neighbors on the old grid, integrate, and renormalize, because the point is not actually to do the entire grid, but only certain zones. In other words, I need to construct a subset of zones in the second grid that have the exact mass of the same region on the first grid, even though the lines of constant coordinates of the two grids are crisscrossing each other in (essentially) arbitrary ways.

Here is an example of what I'm talking about. The colored rectangular grid is in one set of spherical coordinates. The colors indicate different densities within each zone. The theta,phi coordinates of each vertex are specified.

The smaller grid of 6 zones is from a different spherical coordinate grid. The coordinates of all its vertices are also known. I need to "slice up" the density from the same region of the first grid and transfer it into the 6-zone piece of the second grid, exactly conservatively.

http://i27.photobucket.com/albums/c153/Borodog/grid.gif

Any help with an algorithm to do with would be greatly appreciated.

ScottHoward
11-09-2006, 08:47 PM
4?

BluffTHIS!
11-09-2006, 09:17 PM
Boro,

Does this relate to some deeply theoretical aspect of AC theory? Or are you attempting to prove transmission of information is possible with quantum entanglement?

holmansf
11-10-2006, 05:39 PM
I don't understand the problem. Are the points in the grid all on a sphere, or a plane (or neither)?

Borodog
11-10-2006, 05:59 PM
[ QUOTE ]
I don't understand the problem. Are the points in the grid all on a sphere, or a plane (or neither)?

[/ QUOTE ]

They're all on the surface of a sphere.

holmansf
11-10-2006, 06:08 PM
When you rotate the sphere by ninety degrees in the polar variable, the new grid doesn't arbitrarily line up with the old one does it? The azimuthal coordinates are unchanged. Are you just interested in this case, ninety degree polar rotation, or would you like to be able to do this for arbitrary rotations?

Borodog
11-10-2006, 07:16 PM
The azimuthal coordinates are definitely NOT unchanged. I'm specifically interested in the 90 degree case; it does not need to be generalized (a generalized algorithm would certainly be overkill).

holmansf
11-10-2006, 07:58 PM
Huh, we must be talking about different coordinate systems. When you say spherical coordinates on the sphere of radius r, I think if the following map:

(theta (polar), phi (azimuth)) to (r cos(theta)sin(phi), r sin(theta) sin(phi), r cos(phi))

Also, when you say ninety degree rotation in the polar angle, I think of the rotation represented by the matrix (latex style):

0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1

Certainly the azimuthal angle from above is preserved by this rotation (note that it's simply accomplished in the spherical coordinates by (theta,phi) goes to (theta + 90, phi)). What definitions of azimuthal angle and ninety degree polar rotation are you using?

Borodog
11-12-2006, 09:08 PM
[ QUOTE ]
Huh, we must be talking about different coordinate systems. When you say spherical coordinates on the sphere of radius r, I think if the following map:

(theta (polar), phi (azimuth)) to (r cos(theta)sin(phi), r sin(theta) sin(phi), r cos(phi))

Also, when you say ninety degree rotation in the polar angle, I think of the rotation represented by the matrix (latex style):

0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1

Certainly the azimuthal angle from above is preserved by this rotation (note that it's simply accomplished in the spherical coordinates by (theta,phi) goes to (theta + 90, phi)). What definitions of azimuthal angle and ninety degree polar rotation are you using?

[/ QUOTE ]

This is the exact scenario:

http://i27.photobucket.com/albums/c153/Borodog/yinyang.png

There are two spherical coordinate grids that extend form -pi/4 to + pi/4 in (equatorially measured) polar angle, and from +pi/4 to 7pi/4 in azimuthal angle. The catch is that the two grids are rotated relative to each other. The actual rotation of the first grid to get the second is not simply 90 degrees of polar angle as I indicated; I was being sloppy. It's actually a rotation through first 180 degrees of around the z axis (vertical), and then a 90 degree rotation about the axis that threads the "notch" in the original grid.

What this does is stich the 2 spherical coordinate grids together like the cover of a baseball, so that together they cover the whole solid angle, with a little bit of overlap (the triangular regions).

I need to map the densities from one grid into the zones of the other grid exactly conservatively, and frankly, I am stumped. It's a real bitch of a problem.

Borodog
11-12-2006, 10:58 PM
And if that isn't clear enough, here is one grid laid on top of the other, in the coordinate system of the latter.

http://i27.photobucket.com/albums/c153/Borodog/projection.png

Borodog
11-13-2006, 12:30 AM
Ok, since nobody has any clue, I guess I'll start working through it until someone sees some math that makes sense to them.

Imagine each zone is bounded by 4 line segments. This is not quite true, since the edges are actually curves, but the zone size should be small enough that this won't make too large of an error, and any two adjacent zones will have the same error, so the algorithm will still be conservative, even if a tiny fraction of mass ends up in the wrong zone.

There are a number of ways to define the cell sides. I have a hunch that the most useful way is to provide the 2d coordinates of the center of the side, and a 2d direction for the normal into the cell. The cell is then the volume bounded by those 4 lines.

If anyone knows an algorithm for calculating the volume of the shape formed by an arbitrary set of lines, I would really love to hear it, because that would solve my problem.

Consider some function F that calculates the volume of the shape bounded by lines L1, L2, . . . LN: V = F(L1, L2, . . . LN).

Then my problem is solved by simply calculating the volume of the piece that lies in both cell m and cell n: V(m,n) = V(n,m) = F(m1,m2,m3,m4,n1,n2,n3,n4).

http://i27.photobucket.com/albums/c153/Borodog/image001-1.gif

Borodog
11-13-2006, 01:20 AM
Got it.

I have the general formula for the area of a polygon of N sides given (x1,y1) . . . (xN,yN). The vertices of the intersection of quad m and quad n are the vertices of m that lie within n and vice versa, plus the intersections of the sides of quad m with the sides of quad n. To get the latter, I'll have to calculate the intersections of all the lines that form the sides of m with all of the lines that form the sides of n, and then check to see if they lie between the ends of the sides, but that's all plug and chug.