home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume20 / sipp2.0 / patch02 next >
Encoding:
Text File  |  1991-05-29  |  6.2 KB  |  195 lines

  1. Newsgroups: comp.sources.misc
  2. From: Inge Wallin <ingwa@isy.liu.se>
  3. Subject:  v20i021:  sipp2.0 - a library for 3D graphics, Patch02
  4. Message-ID: <1991May29.024950.12943@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 12f353314fabfb3a91a4152920990eb2
  6. Date: Wed, 29 May 1991 02:49:50 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Inge Wallin <ingwa@isy.liu.se>
  10. Posting-number: Volume 20, Issue 21
  11. Archive-name: sipp2.0/patch02
  12. Patch-To: sipp2.0: Volume 16, Issue 5-10
  13.  
  14. The following context diff brings SIPP, the Simple polygon processor
  15. to version 2.0.2.  The diff fixes a bug which sometimes caused
  16. polygons to erroneously be marked as facing from the viewer although
  17. they in reality were not.
  18.  
  19. The patch can also be fetched by anonymous ftp from isy.liu.se
  20. (130.236.1.3) in the subdirectory pub/sipp.
  21.  
  22.     /Inge and Jonas
  23.  
  24.                          O /         \ O
  25. ------------------------- X snip snip X ------------------------------
  26.                          O \         / O
  27.  
  28. Common subdirectories: sipp-2.0.1/demo and sipp-2.0.2/demo
  29. Common subdirectories: sipp-2.0.1/doc and sipp-2.0.2/doc
  30. Common subdirectories: sipp-2.0.1/libsipp and sipp-2.0.2/libsipp
  31. diff -c -r sipp-2.0.1/libsipp/geometric.c sipp-2.0.2/libsipp/geometric.c
  32. *** sipp-2.0.1/libsipp/geometric.c    Mon May 27 22:52:57 1991
  33. --- sipp-2.0.2/libsipp/geometric.c    Mon May 27 22:40:51 1991
  34. ***************
  35. *** 103,108 ****
  36. --- 103,114 ----
  37.       
  38.       cosang = cos(ang);
  39.       sinang = sin(ang);
  40. +     if (fabs(cosang) < 1.0e-15) {
  41. +         cosang = 0.0;
  42. +     }
  43. +     if (fabs(sinang) < 1.0e-15) {
  44. +         sinang = 0.0;
  45. +     }
  46.       for (i = 0; i < 4; ++i) {
  47.       tmp = mat->mat[i][1];
  48.       mat->mat[i][1] = mat->mat[i][1] * cosang
  49. ***************
  50. *** 136,141 ****
  51. --- 142,153 ----
  52.       
  53.       cosang = cos(ang);
  54.       sinang = sin(ang);
  55. +     if (fabs(cosang) < 1.0e-15) {
  56. +         cosang = 0.0;
  57. +     }
  58. +     if (fabs(sinang) < 1.0e-15) {
  59. +         sinang = 0.0;
  60. +     }
  61.       for (i = 0; i < 4; ++i) {
  62.       tmp = mat->mat[i][0];
  63.       mat->mat[i][0] = mat->mat[i][0] * cosang
  64. ***************
  65. *** 169,174 ****
  66. --- 181,192 ----
  67.       
  68.       cosang = cos(ang);
  69.       sinang = sin(ang);
  70. +     if (fabs(cosang) < 1.0e-15) {
  71. +         cosang = 0.0;
  72. +     }
  73. +     if (fabs(sinang) < 1.0e-15) {
  74. +         sinang = 0.0;
  75. +     }
  76.       for (i = 0; i < 4; ++i) {
  77.       tmp = mat->mat[i][0];
  78.       mat->mat[i][0] = mat->mat[i][0] * cosang
  79. Only in sipp-2.0.2/libsipp: patchlevel.h
  80. diff -c -r sipp-2.0.1/libsipp/sipp.c sipp-2.0.2/libsipp/sipp.c
  81. *** sipp-2.0.1/libsipp/sipp.c    Mon May 27 22:52:59 1991
  82. --- sipp-2.0.2/libsipp/sipp.c    Mon May 27 22:47:00 1991
  83. ***************
  84. *** 19,24 ****
  85. --- 19,28 ----
  86.    *
  87.    * Revision history:
  88.    *
  89. +  * 910527  Ver. 2.0.2. A major bug in traverse_object_tree() fixed.
  90. +  *         The invers transformation of the eyepoint was not correct, 
  91. +  *         causing polygons erroneously to be marked as backfacing.
  92. +  *
  93.    * 910412  Ver. 2.0.1. Some minor bugfixes. Division by zero in
  94.    *         create_edges() if an edge was horizontal in both x and y.
  95.    *         Free-list became corrupted since the y_bucket was freed
  96. ***************
  97. *** 89,95 ****
  98.   #include <geometric.h>
  99.   
  100.   
  101. ! #define VERSION "2.0.1"
  102.   
  103.   #define ZCLIPF 100.0        /* Magic number used when defining hither & yon */
  104.   
  105. --- 93,99 ----
  106.   #include <geometric.h>
  107.   
  108.   
  109. ! #define VERSION "2.0.2"
  110.   
  111.   #define ZCLIPF 100.0        /* Magic number used when defining hither & yon */
  112.   
  113. ***************
  114. *** 1850,1855 ****
  115. --- 1854,1861 ----
  116.       Polygon *polyref;
  117.       Vector   eyepoint, tmp;
  118.       double   loc_view_mat[4][4];
  119. +     double   m[3][4], dtmp;
  120. +     int      i, j;
  121.   
  122.   
  123.       if (object == NULL) {
  124. ***************
  125. *** 1873,1884 ****
  126.           tmp.x -= curr_mat.mat[3][0];
  127.           tmp.y -= curr_mat.mat[3][1];
  128.           tmp.z -= curr_mat.mat[3][2];
  129. !         eyepoint.x = (tmp.x * curr_mat.mat[0][0] + tmp.y * curr_mat.mat[0][1]
  130. !                       + tmp.z * curr_mat.mat[0][2]);
  131. !         eyepoint.y = (tmp.x * curr_mat.mat[1][0] + tmp.y * curr_mat.mat[1][1]
  132. !                       + tmp.z * curr_mat.mat[1][2]);
  133. !         eyepoint.z = (tmp.x * curr_mat.mat[2][0] + tmp.y * curr_mat.mat[2][1]
  134. !                       + tmp.z * curr_mat.mat[2][2]);
  135.   
  136.           for (surfref = objref->surfaces; surfref != NULL; 
  137.                surfref = surfref->next) {
  138. --- 1879,1926 ----
  139.           tmp.x -= curr_mat.mat[3][0];
  140.           tmp.y -= curr_mat.mat[3][1];
  141.           tmp.z -= curr_mat.mat[3][2];
  142. !         m[0][0] = curr_mat.mat[0][0] ; m[0][1] = curr_mat.mat[1][0];
  143. !         m[0][2] = curr_mat.mat[2][0] ; m[0][3] = tmp.x;
  144. !         m[1][0] = curr_mat.mat[0][1] ; m[1][1] = curr_mat.mat[1][1];
  145. !         m[1][2] = curr_mat.mat[2][1] ; m[1][3] = tmp.y;
  146. !         m[2][0] = curr_mat.mat[0][2] ; m[2][1] = curr_mat.mat[1][2];
  147. !         m[2][2] = curr_mat.mat[2][2] ; m[2][3] = tmp.z;
  148. !         if (m[0][0] == 0.0) {
  149. !             if (m[1][0] != 0.0)
  150. !                 j = 1;
  151. !             else
  152. !                 j = 2;
  153. !             for (i = 0; i < 4; i++) {
  154. !                 dtmp     = m[0][i];
  155. !                 m[0][i] = m[j][i];
  156. !                 m[j][i] = dtmp;
  157. !             }
  158. !         }
  159. !         
  160. !         for (j = 1; j < 3; j++) {
  161. !             m[j][0] /= (-m[0][0]);
  162. !             for (i = 1; i < 4; i++)
  163. !                 m[j][i] += m[0][i] * m[j][0];
  164. !         }
  165. !         
  166. !         if (m[1][1] == 0.0)
  167. !             for (i = 1; i < 4; i++) {
  168. !                 dtmp     = m[1][i];
  169. !                 m[1][i] = m[2][i];
  170. !                 m[2][i] = dtmp;
  171. !             }
  172. !         
  173. !         if (m[1][1] != 0.0) {
  174. !             m[2][1] /= (-m[1][1]);
  175. !             m[2][2] += m[1][2] * m[2][1];
  176. !             m[2][3] += m[1][3] * m[2][1];
  177. !         }
  178. !         
  179. !         eyepoint.z = m[2][3] / m[2][2];
  180. !         eyepoint.y = (m[1][3] - eyepoint.z * m[1][2]) / m[1][1];
  181. !         eyepoint.x = (m[0][3] - eyepoint.z * m[0][2] 
  182. !                       - eyepoint.y * m[0][1]) / m[0][0];
  183.   
  184.           for (surfref = objref->surfaces; surfref != NULL; 
  185.                surfref = surfref->next) {
  186.  
  187.  
  188. exit 0 # Just in case...
  189. -- 
  190. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  191. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  192. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  193. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  194.