|
From: Daniel J S. <dan...@ie...> - 2007-01-11 09:06:44
|
Ethan Merritt wrote: > On Wednesday 10 January 2007 22:50, Daniel J Sebald wrote: > >>>>One thing I notice when the fill is solid is that along some of the >>>>edges of the Kuen's surface example are some oddly shaped surface >>>>elements. >> >>I'm pretty certain this is a bug; there are some elements from a hidden >>surface for some reason being mixed in with the elements from the visible >>surface. Hidden lines works as it should. > > > > The "depthorder hidden3d" option of pm3d is just plain different from the > "set hidden3d" code. They will not, in general produce the same result. Oh, so the "depthorder hidden3d" draws a line around each element, right? And this sort of mimmicks what hidden3d looks like, I assume? > The "set pm3d depthorder" doesn't really calculate hidden lines or surfaces > at all (please see docs); it just sorts the quadrangles based on the mean > W-coordinate of each, and draws them in order of increasing W. I see. Draw the ones that are further back in the view (on average) first. Unfortunately, in this case with that thin edge there are some elements of the hidden surface which are further forward than the elements on the visible surface. > "W" here is the virtual axis from the center of the plot to your eye. > Because it uses the mean W of the whole tile to make a call for the entire tile, > you can get misplaced corners if the protrude above/below the mean W of the > next tile in view. C'est la vie. Yeah, c'est la vie. Not exactly the desired effect. Hmm, might there be a slight alteration of this that would work "better"? (I.e., works differently but gives an effect more suitable for other desired scenarios.) Rather than carrying out a bubble sort on depthorder, couldn't we carry out a bubble sort on "covered by"? Imagine taking two quadrangles somewhere in 3D space. With respect to W, the projection from N dimensional space to N-1 dimensional space there are three scenarios that can occur: 1) There is no overlap of the elements. Doesn't matter which order the elements are displayed. 2) Element #1 covers a portion of element #2 *and* no portion of element #2 covers element #1. Element #2 should be drawn first. 3) Element #2 covers a portion of element #1 *and* no portion of element #1 covers element #1. Element #1 should be drawn first. 4) Tricky part: Element #1 covers a portion of element #2 *and* a portion of element #2 covers element #1. Hmm what to do. Random? No. Percentage of which is covered more? Perhaps. Fall back on depth order in this case? Perhaps. Anyway, it shouldn't be too difficult to write a routine, given two elements that establishes draw order for the scenarios above. (BTW, a portion of the image code is like this, i.e., Does the corner of this pixel land inside the view box? Vice versa? That sort of thing.) OK, so the idea is rather than a bubble sort with the question "Which is deeper?", the sort would be carried out with the question "Which is covered?" After the bubble sort, the sequence at which elements are drawn may come out funny, but I doubt it would bother too many people. Dan |