Talk:Orthographic projection (cartography)

From Wikipedia, the free encyclopedia

WikiProject Geography

This article is supported by the Geography WikiProject, a collaborative effort to improve Wikipedia's coverage on Geography and related subjects on Wikipedia. Please participate by editing the article Geography, or visit the project page for more details on the projects.

??? This article has not yet received a rating on the assessment scale.

[edit] Removing the C++ example

Would there be any objections to scrapping the C++ section? It's a bit off topic, and makes sense to <1% of the audience (myself included, and I understand code and GIS). I thought I'd add it here before doing it myself.+mwtoews 05:53, 11 January 2007 (UTC)

Okay, I've removed the example. Here it is for the very few who would care:
  The following [[source code]] fragment demonstrates this algorithm in [[C++]]:

 // Loop through rows and columns of output image f_xy
 // obtaining longitude and latitude at each (x, y) point.
 for (i = 0; i < rows; ++i)                                                                                        
 {
     for (j = 0; j < cols; ++j)
     {
         // Here, (LON, LAT) is a grid of longitudes
         // and latitudes defined at each (x[i], y[j])
         // in the projection plane.  Determined using
         // the inverse orthographic projection.
         lon_pt = LON(i, j);
         lat_pt = LAT(i, j);
         //
         // Interpolate inside image(LON, LAT)
         bool in_domain = DOM(i, j);
         if (in_domain)
         {
             //////////////////////////////
             // Longitudinal periodicity //
             //////////////////////////////
             double test_lon_pt = lon_pt;
             while (test_lon_pt > lon_max)
                 test_lon_pt -= 2*pi;
             while (test_lon_pt < lon_min)
                 test_lon_pt += 2*pi;
             // In case of while loop overshoot
             if (test_lon_pt > lon_max)
                 test_lon_pt = lon_max;
             if (test_lon_pt < lon_min)
                 test_lon_pt = lon_min;
             lon_pt = test_lon_pt;
             //
             // Pole points might not be defined, so just go to the
             // highest +/- latitutude values available.
             if (lat_pt > lat_max)
                 lat_pt = lat_max;                                                                                 
             if (lat_pt < lat_min)
                 lat_pt = lat_min;
             //
             // Invoke, for example, bilinear interpolation to obtain f(x,y)
             f_xy_pt = bilinear(image, lat, lon, image_rows, image_cols, lat_pt, lon_pt);
             f_xy(i, j) = f_xy_pt;
         }
     }
 }