**************************************************************************
**************************************************************************
         TRIANGULAR GEOMETRY FOR PERSISTENCE OF VISION 3.1x
**************************************************************************
**************************************************************************

Created by Uwe Zimmermann, Stockholm, Sweden 1999

1.0  INSTALLATION
2.0  INTRODUCTION
3.0  DESCRIPTION OF THE MACROS
4.0  CONTACTING THE AUTHOR

**************************************************************************


1.0  INSTALLATION
**************************************************************************
Just copy the POVRay include file "geometry.inc" into one of the 
directories (folders) in your POVRay library path or the path of 
your POVRay main scene file.  


2.0  INTRODUCTION
**************************************************************************
The macros defined in the include file "geometry.inc" allow you to
calculate basic triangular geometrics such as inner and outer circles,
center of mass etc. Additionally some macros provide patterns to
create images of milimeter ratered paper, hatched areas, lines,
vectors, arrows and a mark for the origin of a scene.
  

3.0  DESCRIPTION OF THE MACROS
**************************************************************************

   #macro draw_line(point_1, point_2, line_radius, line_texture)
   
        just draws a cylinder between the given coordinates with a given
        texture and radius. The cylinder is terminated by two spheres to 
        allow for smooth junctions between two lines.                                                                         
        

   #macro draw_vector(point_1, point_2, line_radius, line_texture)
   
        draws an oriented vector arrow between the given coordinates with 
        a given texture and radius.
        

   #macro draw_distance(point_1, point_2, line_radius, line_texture)
      
        draws a double-ended arrow between the given coordinates with a 
        given texture and radius.
        

   #macro mm_paper(filter_factor)
   
        returns the texture parameters for a milimeter spaced paper.
        The filter factor determines the transparency of the paper.
        usage:
                 texture { mm_paper(filter_factor) }       
                 

   #macro fill_slash(filter_factor)

        returns the texture parameters for a slashed filling.
        The filter factor determines the transparency of the pattern.
        usage:
                 texture { fill_slash(filter_factor) }       
   

   #macro fill_backslash(filter_factor)

        returns the texture parameters for a backslashed filling.
        The filter factor determines the transparency of the pattern.
        usage:
                 texture { fill_backslash(filter_factor) }       
   

   #macro fill_x(filter_factor)

        returns the texture parameters for a crossed filling.
        The filter factor determines the transparency of the pattern.
        usage:
                 texture { fill_x(filter_factor) }       

   
   #macro draw_origin(view_vector)                                                                            

        marks the origin of a scene. If not translated or rotated, three 
        arrows are drawn in the x, y and z direction respectively. The 
        vectors are differently colored (x - red, y - green, z - blue) 
        and a letter at the end of each vector marks its direction. The 
        letters are oriented toward the direction of the vector 'view_vector'
        if it's given as a non-zero length vector.
        

   #macro triangle_normal(corner_1, corner_2, corner_3)
      
        returns the surface normal of the triangle given by the three 
        corners 'corner_1', 'corner_2' and 'corner_3'.
        As POVRay defines a left-handed coordinate system, the normal 
        vector points to the direction from which the corner points are 
        seen in clockwise direction.
        The surface normal is defined by the normalization of the cross 
        product of two adjacent side vectors.


   #macro triangle_H (corner_1, corner_2, corner_3)
        
        returns the vector pointing to the center of mass H of the triangle 
        given by the three corners 'corner_1', 'corner_2' and 'corner_3'.
        The center of mass of a triangle is the crossing point of the
        three lines that originating from one corner and bisecting the
        opposite side or by the average of the corner vectors.

        
   #macro triangle_M (corner_1, corner_2, corner_3)

        returns the vector pointing to the center M of the outer circle of 
        the triangle given by the three corners 'corner_1', 'corner_2' and 
        'corner_3'.
        The center of the outer circle of a triangle is equal to the crossing
        point of the three lines standing perpendicular on the sides of the 
        triangle.
        
                                                         
   #macro triangle_r_outer (corner_1, corner_2, corner_3)
   
        returns the scalar value of the radius r_o of the outer circle of the 
        triangle given by the three corners 'corner_1', 'corner_2' and 
        'corner_3'. The outer radius of a triangle is given by the quotient
        
             r_outer = a / (2 sin(alpha) )  

        where a denotes a side and alpha the angle at the opposing corner.
             
   
   #macro triangle_area (corner_1, corner_2, corner_3)
       
        returns the scalar value of the area A of the triangle given by the three 
        corners 'corner_1', 'corner_2' and 'corner_3'.
        The area of a triangle is given as half the product of a side and the height
        line perpendicular to this side or by half the vector length of the cross 
        product of two adjacent side vectors.
         

   #macro triangle_circumference (corner_1, corner_2, corner_3)
   
        returns the scalar value of the circumference (i.e. the sum of the sides) of the 
        triangle given by the three corners 'corner_1', 'corner_2' and 'corner_3'.


   #macro triangle_r_inner (corner_1, corner_2, corner_3)

        returns the scalar value of the radius r_o of the inner circle of the triangle 
        given by the three corners 'corner_1', 'corner_2' and 'corner_3'.
        The inner radius of a triangle is given as the quotient
        
            r_inner = A / s
            
        where A denotes the area of the triangle and s is half the circumference of
        the triangle.     

   #macro triangle_W (corner_1, corner_2, corner_3)

        returns the vector pointing to the center W of the inner circle of the 
        triangle given by the three corners 'corner_1', 'corner_2' and 'corner_3'.
        The center of the inner circle of a triangle is the crossing point of the 
        bisections of the angles at the three corners.
                                                         

   #macro parallelize(vector_1, vector_2)
      
        returns the rotation directives to rotate a given vector (or object)
        'vector_1' so that it becomes parallel to the given control vector 'vector_2'.
        It is useful to orient objects that are created in a planar orientation (e.g.
        'TEXT' objects or 'TORUS' objects) into a given spacial direction.
        Usage:
                object { "here comes your object definition....."
                         parallelize (vector_1, vector_2)
                       }                                
                       
 

4.0  CONTACTING THE AUTHOR
**************************************************************************
If you wish to contact me with bug reports, bug fixes, criticisms, 
comments, suggested improvements, questions, etc. you can reach me by 
email at:

   uwezi@geocities.com

or by regular mail at:

   Uwe Zimmermann
   Dept. of Electronics
   Royal Institute of Technology
   Electrum 229
   S-16440 Stockholm
   Sweden

**************************************************************************

POV-Ray(tm) and Persistence of Vision(tm) are registered trademarks of the
POV-Ray Team(tm)
