home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / graphic / qrt / techman.doc < prev    next >
Encoding:
Text File  |  1989-03-26  |  20.9 KB  |  595 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.         
  14.  
  15.         
  16.  
  17.                              QRT Technical Reference
  18.  
  19.         
  20.  
  21.         
  22.  
  23.         INTRODUCTION
  24.  
  25.         
  26.  
  27.         The QRT ray tracing system  has  been  designed  to make the code
  28.  
  29.         easily maintainable and  expandable.   An  object oriented design
  30.  
  31.         philosophy was used for the  program,  and the resulting code has
  32.  
  33.         been made as robust as practical given time constraints.
  34.  
  35.         
  36.  
  37.         This document explains the design of QRT.  First, the function of
  38.  
  39.         each QRT C file will be listed.    Next,  the QRT data structures
  40.  
  41.         will  be  explained,   and   finally,   some   details   of  code
  42.  
  43.         implementation discussed.
  44.  
  45.         
  46.  
  47.         
  48.  
  49.         QRT C CODE FILES
  50.  
  51.         
  52.  
  53.         The QRT code is broken down  into  16 C files and 3 header files,
  54.  
  55.         each containing a group of related  functions.  The files are, in
  56.  
  57.         alphabetical order:
  58.  
  59.         
  60.  
  61.            FILE              FUNCTION                              
  62.  
  63.         
  64.  
  65.            bbox.c            bounding box intersection routines
  66.  
  67.            error.c           error reporting routines
  68.  
  69.            inout.c           recursive decent input parser
  70.  
  71.            instance.c        file for INSTANCE primitives
  72.  
  73.            intersect.c       object intersection routines
  74.  
  75.            lexer.c           simple lexical analyzer
  76.  
  77.            mth.c             vector math support
  78.  
  79.            norm.c            normal finding functions for objects
  80.  
  81.            offset.c          offsets a primitive by dx, dy, dz
  82.  
  83.            pattern.c         finds pattern info for objects
  84.  
  85.            patternio.c       auxiliary parser for patterns
  86.  
  87.            precomp.c         pre-computes some info for objects
  88.  
  89.            qrt.c             main routine and initialization code
  90.  
  91.            ray.c             actual ray tracing algorithims
  92.  
  93.            relpos.c          finds relative position on an object
  94.  
  95.            resize.c          resize any primitive
  96.  
  97.            stack.c           stack and object creation routines
  98.  
  99.         
  100.  
  101.            header.h          instantiations of some global variables
  102.  
  103.            pattern.h         pattern info
  104.  
  105.            qrt.h             main data structure definitions
  106.  
  107.         
  108.  
  109.         
  110.  
  111.         The function of each  group  of  routines  will  be  discussed in
  112.  
  113.         greater detail in rest of this document.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.         QRT Ray Tracer               Page 1           Technical Reference
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.         
  146.  
  147.         
  148.  
  149.         DATA STRUCTURES
  150.  
  151.         
  152.  
  153.         All QRT data  structures  are  defined  in  qrt.h.   This file is
  154.  
  155.         broken down into sections, as follows:
  156.  
  157.         
  158.  
  159.          OBJECT TYPE DEFINITIONS:
  160.  
  161.            
  162.  
  163.            C #define  statements  for  each  object  type  (sphere, lamp,
  164.  
  165.            observer, etc).
  166.  
  167.            
  168.  
  169.            
  170.  
  171.          MISC DEFINES
  172.  
  173.            
  174.  
  175.            Other #defines for screen size, etc.
  176.  
  177.            
  178.  
  179.            
  180.  
  181.          VECTOR data structure
  182.  
  183.            
  184.  
  185.            A floating point 3-tuple vector definition.
  186.  
  187.            
  188.  
  189.            
  190.  
  191.          COLOR VECTOR data structure
  192.  
  193.            
  194.  
  195.            A red,green,blue integer 3-tuple structure.
  196.  
  197.            
  198.  
  199.            
  200.  
  201.          COLOR INFO structure
  202.  
  203.            
  204.  
  205.            This is an important structure. It lists color information for
  206.  
  207.            an    object,    including    ambient    and   diffuse   light
  208.  
  209.            characteristics,  reflection   and  transmission  data,  Phong
  210.  
  211.            specular  reflection  coefficient,  index  of  refraction, and
  212.  
  213.            object dithering data.
  214.  
  215.            
  216.  
  217.            
  218.  
  219.          PRECOMPUTE structure
  220.  
  221.            
  222.  
  223.            This contains some fields which can be filled with precomputed
  224.  
  225.            information before the ray-tracing  is begun.  This saves time
  226.  
  227.            by eliminating redundant  calculations  for  every line/object
  228.  
  229.            intersection.   The  use   of   these  fields  is  up  to  the
  230.  
  231.            intersection routines.  Each  object  also  has a 'precompute'
  232.  
  233.            routine which fills this structure.
  234.  
  235.            
  236.  
  237.            
  238.  
  239.          PATTERN structure
  240.  
  241.            
  242.  
  243.            The  pattern  definition   structure  contains  a  color  info
  244.  
  245.            structure.  It is used  to  change  the  characteristics  of a
  246.  
  247.  
  248.  
  249.  
  250.  
  251.         QRT Ray Tracer               Page 2           Technical Reference
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.            primitive  object  over  the  surface  of  that  object.   For
  278.  
  279.            example, checkered, brick, or tile patterns may be defined.
  280.  
  281.            
  282.  
  283.            
  284.  
  285.          OBJECT structure
  286.  
  287.            
  288.  
  289.            The base structure of  QRT.   All  objects  are  defined as an
  290.  
  291.            object structure.  This structure contains:
  292.  
  293.            
  294.  
  295.               A) A location vector for the object
  296.  
  297.               B) 3 directional vectors
  298.  
  299.               C) The object type flag
  300.  
  301.               D) Some constants for QUADRATIC objects
  302.  
  303.               E) A color info structure
  304.  
  305.               F) Sibling and child pointers for the object tree
  306.  
  307.               G) A pointer to a pattern structure
  308.  
  309.               H) A pointer to a pattern for the REMOVE command
  310.  
  311.               I) x and y multipliers for pattern sizing
  312.  
  313.               J) A name field for the object
  314.  
  315.            
  316.  
  317.            
  318.  
  319.          WORLD structure
  320.  
  321.            
  322.  
  323.            This structure contains all data about the world.  It contains
  324.  
  325.            pointers to the object tree, the  lamp list, the observer, and
  326.  
  327.            the sky, and the pattern  stack.   It  also contains statistic
  328.  
  329.            information, such as  total  number  of  rays  traced, and the
  330.  
  331.            output file name and pointer.
  332.  
  333.            
  334.  
  335.            
  336.  
  337.          OBJECT_DATA structure
  338.  
  339.            
  340.  
  341.            The header.h file contains  an  array  of  this structure, one
  342.  
  343.            array element per object type.   The structure itself contains
  344.  
  345.            pointers to functions that perform  known operations on object
  346.  
  347.            structures.  This design  allows  much cleaner code and easier
  348.  
  349.            addition of object types.  The object function pointers are:
  350.  
  351.            
  352.  
  353.               ColTest:  Tests for object collisions
  354.  
  355.            
  356.  
  357.               FindNorm: Finds normal to surface at a given position
  358.  
  359.            
  360.  
  361.               FindBbox: Computes size of bounding box for object
  362.  
  363.            
  364.  
  365.               RelPos:   Finds relative position on object surface
  366.  
  367.                         given a position in space
  368.  
  369.            
  370.  
  371.               PreComp:  Stuffs 'precomp' structure for each object
  372.  
  373.                         before ray-tracing is begun.  The precomp and
  374.  
  375.                         intersect routines must agree on the exact usage
  376.  
  377.                         of the fields in this structure.
  378.  
  379.  
  380.  
  381.  
  382.  
  383.         QRT Ray Tracer               Page 3           Technical Reference
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.            
  410.  
  411.               Offset:   Moves a primitive by dx, dy, dz.  This is used
  412.  
  413.                         for instances.
  414.  
  415.            
  416.  
  417.               Resize:   Resizes a primitive ( and scales its location
  418.  
  419.                         vector).  This is also used for instances.
  420.  
  421.            
  422.  
  423.            This structure permits expressions such as:
  424.  
  425.            
  426.  
  427.               (*(ObjData[CurrObj->type].ColTest))(line,Currobj,&t);
  428.  
  429.            
  430.  
  431.            which means:
  432.  
  433.            
  434.  
  435.               (collision func for this obj type )(parameters);
  436.  
  437.            
  438.  
  439.            instead of a large case  statement.   Execution is faster, and
  440.  
  441.            if new  objects  are  added,  the  code  does  not  have to be
  442.  
  443.            changed.  If a  certain  operation  is  illegal  for a certain
  444.  
  445.            object type, the ObjData  entry  points  to an Err() function.
  446.  
  447.            This way, if something  goes  wrong,  execution  is terminated
  448.  
  449.            gracefully instead of jumping to a random location in memory.
  450.  
  451.            
  452.  
  453.            
  454.  
  455.          MATH defines
  456.  
  457.            
  458.  
  459.            MIN, MAX, SQRT, DotProd macros
  460.  
  461.            
  462.  
  463.            
  464.  
  465.          DEFAULT structure
  466.  
  467.            
  468.  
  469.            Keeps default color information,  and a few other things, like
  470.  
  471.            resolution and aspect ratio.
  472.  
  473.            
  474.  
  475.            
  476.  
  477.          ERROR codes
  478.  
  479.            
  480.  
  481.            Defines for all possible error conditions
  482.  
  483.            
  484.  
  485.            
  486.  
  487.          ROBUST flag
  488.  
  489.            
  490.  
  491.            There are many sections of code of the form:
  492.  
  493.            
  494.  
  495.               # ifdef ROBUST
  496.  
  497.                  code
  498.  
  499.               # endif
  500.  
  501.            
  502.  
  503.            such that, if ROBUST is defined, the bounds-checking code will
  504.  
  505.            be compiled.  It is recommended  that this flag be always set,
  506.  
  507.            although SLIGHTLY faster execution is possible with it reset.
  508.  
  509.            
  510.  
  511.  
  512.  
  513.  
  514.  
  515.         QRT Ray Tracer               Page 4           Technical Reference
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.            
  542.  
  543.         CODE DESCRIPTION
  544.  
  545.         
  546.  
  547.         The function of each section of  code  will  be described in more
  548.  
  549.         detail here.
  550.  
  551.         
  552.  
  553.         
  554.  
  555.          BBOX.C
  556.  
  557.            
  558.  
  559.            Contains code for each  object  type  that  will determine the
  560.  
  561.            size of the bounding box for that  object.  Bounding boxes are
  562.  
  563.            logical objects that contain other objects.  If a ray does not
  564.  
  565.            strike a bounding box, it  cannot  possibly  strike any object
  566.  
  567.            inside the box.  This  can  increase  execution  speed if used
  568.  
  569.            correctly.
  570.  
  571.            
  572.  
  573.            Routines in BBOX.C are of the form:
  574.  
  575.            
  576.  
  577.              BboxSphere(v1,v2,obj)
  578.  
  579.                VECT_PTR v1,v2;
  580.  
  581.                OBJ_PTR obj;
  582.  
  583.            
  584.  
  585.            where v1 and  v2  are  vectors  for  the  two  corners  of the
  586.  
  587.            bounding box, and obj is a pointer to an object.
  588.  
  589.            
  590.  
  591.            The functions  are  called  based  upon  their  pointer in the
  592.  
  593.            ObjData structure.
  594.  
  595.            
  596.  
  597.            
  598.  
  599.          ERROR.C
  600.  
  601.          
  602.  
  603.            This is a simple file that  contains  just  two routines.  The
  604.  
  605.            first one is the Err() routine that  fills empty places in the
  606.  
  607.            ObjData structure.   The  second  routine  is the actual error
  608.  
  609.            reporting routine.  It takes  two  arguments: an error number,
  610.  
  611.            and an error code.   The  error  number  is  a #define such as
  612.  
  613.            'SYNTAX_ERROR'  or  'INTERNAL_ERROR'.   The  error  code is an
  614.  
  615.            integer used to find the routine  in which the error occurred.
  616.  
  617.            The error code  number  is  arbitrary  but  should  be  unique
  618.  
  619.            throughout the program.  A convention has been set up that all
  620.  
  621.            routines within one C file return  an error code with the same
  622.  
  623.            first digit (501, 502,  503...).   If the error occurred while
  624.  
  625.            parsing the input file, the offending  line number is printed.
  626.  
  627.            Execution is always terminated after calling this routine.
  628.  
  629.            
  630.  
  631.            
  632.  
  633.          INOUT.C
  634.  
  635.            
  636.  
  637.            This is a recursive decent parser  for the input language. The
  638.  
  639.            parser was hand coded, since  YACC  or a similar compiler tool
  640.  
  641.            was  not  available.   The   input   routines  perform  syntax
  642.  
  643.  
  644.  
  645.  
  646.  
  647.         QRT Ray Tracer               Page 5           Technical Reference
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.            checking, and some bounds checking.   The bounds checking will
  674.  
  675.            catch some errors; however, it has not been idiot-proofed.  It
  676.  
  677.            is up to the user to not make strange entries (radius=0, etc).
  678.  
  679.            Most of these illogical errors will  be caught in the run-time
  680.  
  681.            bounds checking.
  682.  
  683.            
  684.  
  685.            INOUT has one routine for  each  non-terminal  in the grammar.
  686.  
  687.            The routine accepts parameters,  in any order, and branches to
  688.  
  689.            another routine, or  inputs  a  value.   This  is  the largest
  690.  
  691.            individual file, at over 1000 lines.
  692.  
  693.            
  694.  
  695.            
  696.  
  697.          INSTANCE.C
  698.  
  699.            
  700.  
  701.            This contains the  routines  to  input  instance  definitions,
  702.  
  703.            create a copy of a sub-tree, offset the subtree, and scale the
  704.  
  705.            subtree.
  706.  
  707.            
  708.  
  709.            
  710.  
  711.          INTERSECT.C
  712.  
  713.            
  714.  
  715.            This   file   contains   routines   to   perform   line/object
  716.  
  717.            intersection tests.  Each routine is of the form:
  718.  
  719.            
  720.  
  721.              int LineSphere(line, sphere, t)
  722.  
  723.                    OBJ_PTR line, sphere;
  724.  
  725.                    float *t;
  726.  
  727.            
  728.  
  729.            where line and sphere are inputs, and t is an output.  Line is
  730.  
  731.            always a line  object,  but  the  second  parameter  may  be a
  732.  
  733.            pointer  a  different  object  for  a  different  intersection
  734.  
  735.            routine.   The routine must  compute  the  parameter T for the
  736.  
  737.            intersection point on the line, if any, and return TRUE if the
  738.  
  739.            line hits the object, or FALSE if it does not.
  740.  
  741.            
  742.  
  743.            The functions  are  called  based  upon  their  pointer in the
  744.  
  745.            ObjData structure.
  746.  
  747.            
  748.  
  749.            
  750.  
  751.          LEXER.C
  752.  
  753.            
  754.  
  755.            This is a simple tokenizer  for  the  input language.  In this
  756.  
  757.            implementation, #include directives for the input language are
  758.  
  759.            not implemented, but they belong  in this routine. This module
  760.  
  761.            also contains some  bounds  checking  code,   and  code to map
  762.  
  763.            values  of   the   range   0..1   to   0..CNUM.    The   light
  764.  
  765.            characteristics are stored as  an  integer from 0 to CNUM, but
  766.  
  767.            the input values are a  floating  point  value from 0 to 1, so
  768.  
  769.            these routines perform the conversion.
  770.  
  771.            
  772.  
  773.            
  774.  
  775.  
  776.  
  777.  
  778.  
  779.         QRT Ray Tracer               Page 6           Technical Reference
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.          MTH.C
  806.  
  807.            
  808.  
  809.            MTH contains support routines for  vector math, such as vector
  810.  
  811.            addition, subtraction, and cross product.
  812.  
  813.            
  814.  
  815.            
  816.  
  817.          NORM.C
  818.  
  819.            
  820.  
  821.            These routines find the normal vector  to an object at a given
  822.  
  823.            location in space.  They are called  based upon the pointer in
  824.  
  825.            the ObjData structure.  A typical entry is:
  826.  
  827.            
  828.  
  829.               SphereNorm(norm, object, position)
  830.  
  831.                 VECT_PTR norm, position;
  832.  
  833.                 OBJ_PTR object;
  834.  
  835.            
  836.  
  837.            where object and position are input, and norm is output.
  838.  
  839.            
  840.  
  841.            Often, several objects share  one  routine.  This happens, for
  842.  
  843.            example,  with  planar  objects,  since  the  code to find the
  844.  
  845.            normal to a plane is the same  regardless  of the shape of the
  846.  
  847.            planar object.
  848.  
  849.            
  850.  
  851.            
  852.  
  853.          OFFSET.C
  854.  
  855.            
  856.  
  857.            These routines are called by  the  object_data  structure. One
  858.  
  859.            routine  exists  per  primitive  type,  and  they  offset  the
  860.  
  861.            primitive by the given amount.
  862.  
  863.            
  864.  
  865.            
  866.  
  867.          PATTERN.C
  868.  
  869.            
  870.  
  871.            When a ray/object intersection is  found, the pattern function
  872.  
  873.            is called.  If  the  objects  pattern  pointer  is  NULL,  the
  874.  
  875.            default color info for that object  is returned.  If it is not
  876.  
  877.            NULL, the the relative position  on the surface of that object
  878.  
  879.            is found, and the color info for  the pattern at that location
  880.  
  881.            is returned.   If  the  relative  location  is  not inside any
  882.  
  883.            sub-pattern, then the object's default color info is returned.
  884.  
  885.            
  886.  
  887.            To determine if  a  given  point  is  inside  a sub-pattern, a
  888.  
  889.            similar strategy to the object intersection  routines is used.
  890.  
  891.            There are several sub-pattern types  (RECTANGLE, CIRCLE, etc),
  892.  
  893.            and there is a table  listing  pointers  to  containment  test
  894.  
  895.            routines for each type.  This makes it easy to add sub-pattern
  896.  
  897.            types.
  898.  
  899.            
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.         QRT Ray Tracer               Page 7           Technical Reference
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.          PATTERNIO.C
  938.  
  939.            
  940.  
  941.            An auxiliary parser for  patterns,  created  because INOUT was
  942.  
  943.            getting  too  large  to  comfortably  edit.   This  file  also
  944.  
  945.            contains routines to copy  subtrees,  as well as to offset and
  946.  
  947.            scale subtrees by calling routines from offset.c and resize.c
  948.  
  949.            
  950.  
  951.            
  952.  
  953.          PRECOMP.C
  954.  
  955.            
  956.  
  957.            Contains  routines  to  stuff   the  'precomp'  structure  for
  958.  
  959.            objects.  See the  documentation  for  the qrt.h file for more
  960.  
  961.            details.   This  structure   saves   time  by  computing  some
  962.  
  963.            expressions  that  do  not   change   with   each  line/object
  964.  
  965.            intersection test.
  966.  
  967.            
  968.  
  969.            
  970.  
  971.          QRT.C
  972.  
  973.            
  974.  
  975.            This module contains initialization code, and the main routine
  976.  
  977.            that loads the 'world'  and  performs  the  ray tracing. It is
  978.  
  979.            quite short.
  980.  
  981.            
  982.  
  983.            
  984.  
  985.          RAY.C
  986.  
  987.            
  988.  
  989.            All of the ray tracing  logic  is  in  this module.  The basic
  990.  
  991.            routine  is  Ray_Trace.   Ray_Trace  looks  for  a  ray/object
  992.  
  993.            intersection.  If it  finds  one,  various  color routines are
  994.  
  995.            called to compute the color of the  object at this point. Some
  996.  
  997.            of these color routines may  call  Ray_Trace  recursively (for
  998.  
  999.            reflection or transmission).
  1000.  
  1001.            
  1002.  
  1003.            Another important routine,  called  by  Ray_Trace, is Ray_Hit.
  1004.  
  1005.            This actually tests  to  see  if  the  ray  hits  an object by
  1006.  
  1007.            walking through the object tree.   If the 'first' flag is set,
  1008.  
  1009.            the routine will quit after it  finds  one object intersection
  1010.  
  1011.            (used to see if a surface is in the shadow of another object).
  1012.  
  1013.            Otherwise, all intersections are sorted in order of increasing
  1014.  
  1015.            parameter T, and the first such intersection returned.
  1016.  
  1017.            
  1018.  
  1019.            
  1020.  
  1021.          RELPOS.C
  1022.  
  1023.            
  1024.  
  1025.            Routines in RELPOS  are  called  by  the  entry in the ObjData
  1026.  
  1027.            array.  A typical routine is:
  1028.  
  1029.            
  1030.  
  1031.            
  1032.  
  1033.                SpherePos(obj,loc,pos1,pos2)
  1034.  
  1035.                  OBJ_PTR  obj;
  1036.  
  1037.                  VECT_PTR loc;
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.         QRT Ray Tracer               Page 8           Technical Reference
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.                  float *pos1, *pos2;
  1070.  
  1071.            
  1072.  
  1073.            
  1074.  
  1075.            where obj and loc are input, and  the routine must compute the
  1076.  
  1077.            coordinates pos1 and pos2 on the  surface of the object.  This
  1078.  
  1079.            is used to map patterns onto the surface of arbitrary objects.
  1080.  
  1081.            It  is  straightforward   for   planar  surfaces.   For  other
  1082.  
  1083.            surfaces, a mapping of the form:
  1084.  
  1085.            
  1086.  
  1087.                3-tuple(x,y,z) --> 2-tuple(x,y)
  1088.  
  1089.            
  1090.  
  1091.            must be created for the object.
  1092.  
  1093.            
  1094.  
  1095.            
  1096.  
  1097.          RESIZE.C
  1098.  
  1099.            
  1100.  
  1101.            These routines resize objects, and  scale the location vector.
  1102.  
  1103.            One routine exists per object.   They are used by the instance
  1104.  
  1105.            routines (as are routines from offset.c).
  1106.  
  1107.            
  1108.  
  1109.            
  1110.  
  1111.          STACK.C
  1112.  
  1113.            
  1114.  
  1115.            This file  contains  support  code  for  object  tree and list
  1116.  
  1117.            manipulations.  The name "STACK"  is partially historical; the
  1118.  
  1119.            initial implementation of the program did not permit arbitrary
  1120.  
  1121.            object trees,  only  linear  lists.   STACK  also  contains an
  1122.  
  1123.            object  creation  routine,   and  a  routine  to  print  world
  1124.  
  1125.            statistics at the end of the ray tracing session.
  1126.  
  1127.            
  1128.  
  1129.            Note that  in  the  files  that  contain  object  manipulation
  1130.  
  1131.            routines (indexed by the  object_data  structure array), there
  1132.  
  1133.            is often a common routine for  several  similar  objects.  For
  1134.  
  1135.            example, all planar objects  (PARALLELOGRAM,  RING,  TRIANGLE)
  1136.  
  1137.            share a common normal finding routine.   If one of them should
  1138.  
  1139.            suddenly need a different routine,  just create it, and change
  1140.  
  1141.            the object_data pointer for that object.
  1142.  
  1143.            
  1144.  
  1145.            Patterns are dealt with in the same  manner as objects.  There
  1146.  
  1147.            are currently three types of  pattern  primitives  (RECTANGLE,
  1148.  
  1149.            CIRCLE,  and  POLYGON).   There   is  a  structure  (like  the
  1150.  
  1151.            object_data structure) for patterns.  This structure currently
  1152.  
  1153.            contains only one entry: a  pointer  to  a collision function.
  1154.  
  1155.            Future capabilities  may  be  added  later,  along  with  more
  1156.  
  1157.            primitive types.
  1158.  
  1159.            
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.         QRT Ray Tracer               Page 9           Technical Reference
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.