Name

        ihm - simple terrain map (stm) with extended IMI footer.

 

Description

        File contains a simple header followed by height data stored as 16-bit unsigned shorts (binary) followed by an optional footer that contains various information about the data.

 

Definition

- The string "STM" (without quotes) in all caps.

- Whitespace (blanks).

- The width of the area (ASCII).

- Whitespace (blanks).

- The height of the area (ASCII).

- Whitespace (blanks).

- A "magic number" that identifies the byte ordering of the rest of the file.
  The "magic number" consists of four bytes that written to the file as an 
  unsigned long.  When reading the unsigned long (read as an array of unsigned
  chars) the values returned should be equal to 0x04030201 when interpreted as
  an unsigned long (a union is typically used to accomplish this).  If any 
  other ordering of the bytes is found, the bytes of the 16-bit height values 
  should be swapped after reading.
 
- Whitespace (newline) -- only one byte.

- width * height values, each a 16-bit unsigned short stored in binary without
  any spacing or padding.  The origin is located at the bottom left corner.

- The "magic number" from the header is repeated immediately following the data.
  This servers as a 'sanity' check and allows us to correct for errors that may
  cause the data to be read incorrectly.  For example:  The 1-byte newline that 
  should follow the "magic number" in the header is converted to the 2-byte CRLF
  sequence when the file is transferred or copied.

- Whitespace (blanks, TABs, CRs, LFs).

- Optionally one of the following commands (without the quotes): 
  "scale" - scales the x, y, and z values according to the passed parameters.
  "trans" - translates the origin according to the passed parameters.
  "orient" - rotates the data around the vertical axis (degrees).

- A parameter list for the previous command.  
  "scale" requires 3 floats.
  "trans" requires 3 floats.
  "orient" requires 1 float.
  NOTE:  The parameter list of any command may be optionally wrapped in
  parenthesis (x, y, z) and may use spaces or commas as delimiters.

- May add commands as desired.  If a duplicate command is found, the last
  entry is used.  

- Optional comments may exist in the footer and are denoted by '#' without the
  quotes.  The hash will mark all text following up to the next newline as a
  comment and will not attempt to interpret it.