3d-2d points
- To: mathgroup at smc.vnet.net
- Subject: [mg24463] 3d-2d points
- From: Jeff Moran <prism at ulster.net>
- Date: Tue, 18 Jul 2000 00:59:08 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Here's the problem: On a 1:2 aspect ratio flat map of the Earth, using virtual colored gels over the geographic satellite imagery, we divided the globe into a dodecahedron12 identical pentagons with 3 converging at either pole and six around the equator. Using the 3D program Lightwave, we rendered an image of each pentagon face on. We know the coordinates, in latitude and longitude, of each point of each pentagon, so given the coordinates of a location somewhere on the globe (e.g. New York City @ 40N42 and 74W00)--we can determine the pentagon to which the location belongs. Our problem is plotting an accurate representation of the location on the rendered image. Our programmer (Aaron) was given very helpful math on how to convert 3D coordinates to 2D which he translated (roughly) into this code: ------------------------------------------------- loc = location coord center = pentagon center coord sloc = loc - center --subtract center from loc coord to make it relative to the center of the pentagon theta = (PI * sloc.horz) / 180 convert coord to radians.. phi = (PI * sloc.vert) / 180 r = 3.5530 -- radius of the sphere in Lightwave x = r * sin(theta) * cos(phi) y = r * sin(phi) z = r * cos(theta) * cos(phi) f + .4696 -- focal length in Lightwave d = 6.3682 -- the distance between the center of the sphere and the viewer in Lightwave sx = (f * x) / (d - z) -- 2D coords of the loc.. sy = (f * y) / (d - z) ---------------------------------- The problem we are encountering now is that this doesn't account for the way latitude curves around the globe. This is especially apparent around the poles (in the uppermost three and lowermost three pentagons) where the curve is most pronounced. The formula treats all locations as if the pentagon were centered (none are) on the equator and prime meridian.