From: Thomas S. <t.s...@fz...> - 2008-05-23 10:10:50
|
> That's a bit strange, because apparently it segfaulted in the > hidden-surface bookkeeping routines rather than anything having to do > with bitmap management. I suppose one of those overflowed coordinates > causes trouble in the depth-sort algorithm. at least i have found what happens: access to non-existing elements of 'quadtree' in procedure 'in_front' in 'hidden3d.c' resulting in useless values for 'listhead' > for (grid_x = grid_x_low; grid_x <= grid_x_high; grid_x ++) > for (grid_y = grid_y_low; grid_y <= grid_y_high; grid_y ++) > for (listhead = quadtree[grid_x][grid_y]; <<====THERE==== but why it happens - don't know. the following patch prevents segfaults and gives warnings: ------------------------------------------------------------------------------ --- hidden3d.c.orig 2008-03-29 10:28:01.000000000 +0100 +++ hidden3d.c 2008-05-23 11:56:46.000000000 +0200 @@ -1801,5 +1801,21 @@ grid_x_low = COORD_TO_TREECELL(xmin); + if (grid_x_low < 0) { + grid_x_low = 0; + fprintf(stderr,"in_front: grid_x_low set to 0\n"); + } grid_x_high = COORD_TO_TREECELL(xmax); + if (grid_x_high >= QUADTREE_GRANULARITY) { + grid_x_high = QUADTREE_GRANULARITY-1; + fprintf(stderr,"in_front: grid_x_high set to QUADTREE_GRANULARITY-1\n"); + } grid_y_low = COORD_TO_TREECELL(ymin); + if (grid_y_low<0) { + grid_y_low = 0; + fprintf(stderr,"in_front: grid_y_low set to 0\n"); + } grid_y_high = COORD_TO_TREECELL(ymax); + if (grid_y_high >= QUADTREE_GRANULARITY) { + grid_y_high = QUADTREE_GRANULARITY-1; + fprintf(stderr,"in_front: grid_y_high set to QUADTREE_GRANULARITY-1\n"); + } ------------------------------------------------------------------------------ gnuplot> set term pbm large size 100,100 gnuplot> set out 'test.pbm' gnuplot> load 'singulr.dem' in_front: grid_x_high set to QUADTREE_GRANULARITY-1 in_front: grid_y_high set to QUADTREE_GRANULARITY-1 in_front: grid_x_high set to QUADTREE_GRANULARITY-1 in_front: grid_y_high set to QUADTREE_GRANULARITY-1 ... Hit return to continue (1) in_front: grid_x_high set to QUADTREE_GRANULARITY-1 in_front: grid_y_high set to QUADTREE_GRANULARITY-1 ... it seems that the 'xmax' and 'ymax' values, set in the macro 'setup_edge', are wrong sometimes. -- View this message in context: http://www.nabble.com/DPU-414-terminal-tp17371497p17422742.html Sent from the Gnuplot - Dev mailing list archive at Nabble.com. |