home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / amiga / graphics / 7569 < prev    next >
Encoding:
Text File  |  1992-11-20  |  3.0 KB  |  90 lines

  1. Newsgroups: comp.sys.amiga.graphics
  2. Path: sparky!uunet!wupost!emory!swrinde!ringer!cqu
  3. From: cqu@ringer.cs.utsa.edu (Chang-ning Qu)
  4. Subject: Help needed about the Normal System.
  5. Message-ID: <1992Nov20.201046.5115@ringer.cs.utsa.edu>
  6. Organization: University of Texas at San Antonio
  7. Date: Fri, 20 Nov 1992 20:10:46 GMT
  8. Lines: 80
  9.  
  10.  
  11.    Hi, there is a 3D American map demograph with the
  12.    48 states' population and income data on Indigo
  13.    machine. It has four display options: draw line,
  14.    draw top, draw solid and draw lighted. We have
  15.    the original code and we are trying to modify it
  16.    to be a Texas county(254) map. After figuring out  
  17.    the data structure, we created a binary file, 
  18.    "counties.bin", with normal system as follows for
  19.    side faces:  
  20.  
  21.        taking any consecutive points (x1,y1,1) and 
  22.        (x2,y2,1) on the top, it could create a side 
  23.        face by adding (x1,y1,0) and (x2,y2,0). So 
  24.        the normal of the face could be determined by :
  25.  
  26.                         |   i     j     k |
  27.    ----->   ->   ->     |                 |
  28.    Normal = L2 X L1 =   | x1-x2  y1-y2  0 |                                     
  29.                         |                 |
  30.                         |   0     0    -1 |
  31.  
  32.             = - (y1-y2)i + (x1-x2)j + 0k
  33.                           
  34.             = [-(y1-y2), (x1-x2), 0] 
  35.    
  36.    then the normalized normal is
  37.  
  38.        -->     -(y1-y2)    x1-x2
  39.         n  = ( --------,  --------, 0 )
  40.                  NORM      NORM
  41.  
  42.                                       2         2
  43.    where  NORM= square root[(-(y1-y2)) + (x1-x2) + 0]
  44.  
  45.  
  46.                           Z
  47.                           ^
  48.                           |
  49.                     ______________
  50.                    |\    1|       \         
  51.              (x1,y1,1)_____________\(x2,y2,1)
  52.                    | |    | <-- |  |
  53.                    | ||   |  L2 |  |  
  54.                    | |v   |     |  |  
  55.                    | |L1  |     |  |
  56.                    | |    |     |  |
  57.                    |_|____|_____|  |
  58.                    \ |   0|_ _ _ \_|_ _ _ Y
  59.                     \|___/________\|
  60.                (x1,y1,0)/      (x2,y2,0) 
  61.                        /
  62.                       /
  63.                      X             
  64.     
  65.  
  66.    The problem is that we couldn't get correct illumination
  67. when displaying in draw-solid and draw-lighted, they are just
  68. reversed (lighted sides to be dark and dark becoming lighted)!
  69.    
  70.     The normal system of the original code seems using
  71.  
  72.        -->      x1-x2     -(y1-y2)
  73.         n  = ( --------,  --------, 0 )
  74.                  NORM       NORM
  75.  
  76.  but it can't make any sense why they calculated in that way!
  77. and we have tried all possibilities of the normal system 
  78. (including their way!), unfortunately, none of them works!
  79. We began to doubt there might be something wrong in the normal
  80. system of the original programs and they were fixed in somewhere
  81. else?
  82.  
  83.     Could anyone help us to figure out what wrong it is? Or 
  84. any suggestion? Thank you in advance.
  85.  
  86. Charlie Qu
  87. FACTT Center
  88. Univ of Texas at San Antonio   
  89. E-mail: charlie@nacho.cr.utsa.edu
  90.