home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / Venus 3.5 / ElevationMap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-01  |  2.1 KB  |  58 lines  |  [TEXT/CWIE]

  1. /*
  2.  ***********************************************************************
  3.  *
  4.  *                                Elevation Map
  5.  *
  6.  * A representation of a surface in space z=f(x,y) to render in 3D view
  7.  *
  8.  * The present ElevationMap class specifies the function z=f(x,y) using
  9.  * a pixel matrix of an IMAGE. The (j,i)-pixel of the IMAGE corresponds to
  10.  * a f(x,y) point of the map; the first argument, j, being the pixel
  11.  * matrix' row index, refers to y; the second argument, i, a column index,
  12.  * corresponds to x coordinate of the map. The value of this pixel is an
  13.  * "elevation code", which is related to a map true elevation z via the
  14.  * following formula
  15.  *         z = map(j,i) < z_cut_off ? 0 : (map(i,j)*elevation_factor)>>9;
  16.  * This formula can scale the pixel values both up and down.
  17.  *
  18.  * Moreover, each "elevation code" is associated with a corresponding color via a
  19.  * private colormap, clu_table. We assume that this colormap is arranged in some
  20.  * order to allow "interpolation". That is, the color for the entry k should be in
  21.  * a sense "in-between" the colors for entries k-1 and k+1.
  22.  *
  23.  * See view_3d.cc for more detail as to how it is all used.
  24.  *
  25.  * $Id$
  26.  *
  27.  ***********************************************************************
  28.  */
  29.  
  30. #pragma once
  31.  
  32. #include "image.h"
  33. #include "window.h"
  34.  
  35. class ElevationMap : public IMAGE
  36. {
  37.   CLUTable clu_table;
  38.   enum { default_clut_id = 128 };
  39.   int z_cutoff, elevation_factor;                // Coefficients to determine elevation z from
  40.                                                   // the map's "elevation code" (pixel value)
  41.                                                   
  42.   ElevationMap(const ElevationMap&);            // Disallow assignments/cloning
  43.   void operator = (const ElevationMap&);        // (at present)
  44.   
  45. public:
  46.   ElevationMap(const int order);                // Make a default elevation map of 
  47.                                       // 2^order X 2^order size
  48.                                       
  49.   const CLUTable& q_clut(void) const    { return clu_table; }
  50.   int q_z_cutoff(void) const            { return z_cutoff; }
  51.   int q_elev_scale(void) const            { return elevation_factor; }
  52.   
  53.   void load(const FSSpec& file_spec);            // Load the map (and possibly clu_table)
  54.                                                   // from a given (PGM) file
  55.   void dump(const char title[]="") const;        // Tell me about this ElevationMap...
  56. };
  57.  
  58.