[gl2ps] Problem with BSP printing (reason found)

Christophe Geuzaine cag32 at case.edu
Tue Feb 14 14:02:23 CET 2006


Shahzad MUZAFFAR wrote:
> Hello,
>   I have already mentioned (in one of my previous email) about the 
> problem with BSP printing not working properly in 1.2.3 and up releases 
> (i.e. printing in reverse order). I think I have found the reason. The 
> problem is in the gl2psRescaleAndOffset() method. The problem occurs 
> when the scaleZ becomes > 100000. Because at scaleZ > 100000 the 
> z-coordinates of all primitive become > 100000 which is above the EYE 
> set in the gl2psPrintPrimitives() method. Thats why we see eps/pdf files 
> printed in reverse order.
>  
> I have added this line in gl2psRescaleAndOffset() method
> 
> if (scaleZ > 100000.F) scaleZ=100000;
> 
> to force the Z scaling. And now printing works properly. Cheers,

I see... The root of the problem is that I forgot to subtract the minZ 
coordinate in the rescaling! I think the "real" fix should thus be to 
replace

prim->verts[j].xyz[2] = prim->verts[j].xyz[2] * scaleZ;

with

prim->verts[j].xyz[2] = (prim->verts[j].xyz[2] - minZ) * scaleZ;

This way the z-buffer coordinate will be in [0, GL2PS_ZSCALE] (that's 
what was intended). Could you try this alternative fix and tell me if it 
also fixes the bug?

Many thanks!

Christophe


> --Shahzad Muzaffar
> _______________________________________________
> gl2ps mailing list
> gl2ps at geuz.org
> http://www.geuz.org/mailman/listinfo/gl2ps
> 


-- 
Christophe Geuzaine
Assistant Professor, Case Western Reserve University, Mathematics
http://www.case.edu/artsci/math/geuzaine