home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / toollib_2 / Examples / Tree / Builds / h / tree < prev    next >
Text File  |  1995-11-22  |  1KB  |  45 lines

  1. /*** tree.h ***/
  2. /* Simple tree drawing routine
  3.  * (c) Paul Field
  4.  * v1.00 - 7/10/95
  5.  * v2.00 - 21/11/95 (More complex trees)
  6.  */
  7.  
  8. #include "line_processor.h"
  9.  
  10.  
  11. /* Values that vary from branch to branch */
  12. typedef struct tree_state_str
  13.  { unsigned segment_length;
  14.    int      tree_angle;
  15.    int      branch_angle;
  16.    unsigned remaining_depth;
  17.  }tree_state;
  18.  
  19.  
  20. /* Values that are constant for every tree branch */
  21. typedef struct tree_parameters_str
  22.  { unsigned segments;
  23.    double   left_proportion;
  24.    double   right_proportion;
  25.    double   length_scale;
  26.    double   length_scale_scale;
  27.    double   angle_scale;
  28.  }tree_parameters;
  29.  
  30.  
  31. /* The complete specification of a tree */
  32. typedef struct tree_def_str
  33.  { tree_state      initial_state;
  34.    tree_parameters parameters;
  35.  }tree_def;
  36.  
  37.  
  38.  
  39. void tree_calculate(int x, int y, const tree_def *tree, const line_processor *lines);
  40.  /* Calculates the lines involved in drawing a tree as defined by 'tree' and passes them to 'lines'.
  41.   * The origin of the tree is (x,y).
  42.   * You can pick any units of length (i.e. for x,y and tree->initial_state.segment_length)
  43.   * although your line_processor may require particular units to be used.
  44.   */
  45.