The R Project SVN R-packages

Rev

Rev 381 | Rev 2125 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 381 Rev 452
Line 218... Line 218...
218
     
218
     
219
     /* printf("\nStarting depth calculation..."); */
219
     /* printf("\nStarting depth calculation..."); */
220
 
220
 
221
     /* Depth Calculation: we need to determine the order in which the
221
     /* Depth Calculation: we need to determine the order in which the
222
      * quadrilaterals are to be drawn. However, It is not clear what
222
      * quadrilaterals are to be drawn. However, It is not clear what
223
      * would be a good criteria to do this. We currently order on the
223
      * would be a good criteria to do this. 
224
      * basis of average facet depth.
-
 
225
     */
224
     */
226
 
225
 
-
 
226
     /* Depth of nearest and farthest corners both have
-
 
227
	problems. Changing to average depth. This still has problems,
-
 
228
	but less frequently
-
 
229
     */
-
 
230
 
-
 
231
 
227
     for (i = 0; i < nh; i++) {
232
     for (i = 0; i < nh; i++) {
228
         double tx, ty, tz, th;
233
         double tx, ty, tz, th;
229
	 int tgi, ti;
234
	 int tgi, ti;
230
	 int txi00, tyi00, tzi00;
235
	 int txi00, tyi00, tzi00;
231
	 int txi01, tyi01, tzi01;
236
	 int txi01, tyi01, tzi01;
Line 276... Line 281...
276
	 tz = z[tzi10];
281
	 tz = z[tzi10];
277
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
282
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
278
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
283
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
279
 
284
 
280
	 /*WAS: if (th > heights[i]) heights[i] = th;  similar below*/
285
	 /*WAS: if (th > heights[i]) heights[i] = th;  similar below*/
-
 
286
	 /* Why change? causes problems with 3D histogram type
-
 
287
	    plots. changing back. Revisit later (FIXME) */
281
	 if (th < heights[i]) heights[i] = th;
288
	 /* if (th > heights[i]) heights[i] = th; */
282
 
-
 
-
 
289
	 /* Still problems, so changing to average depth */
-
 
290
	 heights[i] += th;
283
 
291
 
284
	 /* (1,1) corner */
292
	 /* (1,1) corner */
285
	 tx = x[txi11];
293
	 tx = x[txi11];
286
	 ty = y[tyi11];
294
	 ty = y[tyi11];
287
	 tz = z[tzi11];
295
	 tz = z[tzi11];
288
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
296
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
289
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
297
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
290
	 if (th < heights[i]) heights[i] = th;
298
	 /* if (th > heights[i]) heights[i] = th; */
-
 
299
	 heights[i] += th;
291
 
300
 
292
 
301
 
293
	 /* (0,1) corner */
302
	 /* (0,1) corner */
294
	 tx = x[txi01];
303
	 tx = x[txi01];
295
	 ty = y[tyi01];
304
	 ty = y[tyi01];
296
	 tz = z[tzi01];
305
	 tz = z[tzi01];
297
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
306
	 th = (rot[2] * tx + rot[6] * ty + rot[10] * tz + rot[14]) 
298
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
307
		 / (rot[3] * tx + rot[7] * ty + rot[11] * tz + rot[15]);
299
	 if (th < heights[i]) heights[i] = th;
308
	 /* if (th > heights[i]) heights[i] = th; */
-
 
309
	 heights[i] += th;
-
 
310
 
-
 
311
	 heights[i] /= 4.0;
300
     }
312
     }
301
 
313
 
302
     /* Rprintf("\nFinished depth calculation, ordering...\n");  */
314
     /* Rprintf("\nFinished depth calculation, ordering...\n");  */
303
     
315
     
304
     call = PROTECT(lang2(install("order"), sHeights));
316
     call = PROTECT(lang2(install("order"), sHeights));