Skip to content
Snippets Groups Projects
Commit 186e4926 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better epsilon
parent 1cb2f9e4
No related branches found
No related tags found
No related merge requests found
/* $Id: gl2ps.cpp,v 1.87 2004-11-22 07:36:25 geuzaine Exp $ */ /* $Id: gl2ps.cpp,v 1.88 2004-11-22 07:46:32 geuzaine Exp $ */
/* /*
* GL2PS, an OpenGL to PostScript Printing Library * GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> * Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org>
...@@ -1279,7 +1279,7 @@ static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsil ...@@ -1279,7 +1279,7 @@ static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsil
static void gl2psSetPrecisionAndApplyOffsets() static void gl2psSetPrecisionAndApplyOffsets()
{ {
GL2PSprimitive *prim; GL2PSprimitive *prim;
GLfloat minZ, maxZ; GLfloat minZ, maxZ, simple;
GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ; GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ;
int i, j, offset = 0; int i, j, offset = 0;
...@@ -1305,6 +1305,9 @@ static void gl2psSetPrecisionAndApplyOffsets() ...@@ -1305,6 +1305,9 @@ static void gl2psSetPrecisionAndApplyOffsets()
/* set precision */ /* set precision */
gl2ps->epsilon = (maxZ - minZ) / 5000.0F; gl2ps->epsilon = (maxZ - minZ) / 5000.0F;
simple = (maxZ - minZ) / 500.0F;
if(GL2PS_ZERO(gl2ps->epsilon)) gl2ps->epsilon = 0.0002F;
if(GL2PS_ZERO(simple)) simple = 0.002F;
/* apply offsets */ /* apply offsets */
if(gl2ps->options & GL2PS_SIMPLE_LINE_OFFSET){ if(gl2ps->options & GL2PS_SIMPLE_LINE_OFFSET){
...@@ -1312,12 +1315,12 @@ static void gl2psSetPrecisionAndApplyOffsets() ...@@ -1312,12 +1315,12 @@ static void gl2psSetPrecisionAndApplyOffsets()
prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i); prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i);
if(prim->type == GL2PS_LINE){ if(prim->type == GL2PS_LINE){
if(gl2ps->sort == GL2PS_SIMPLE_SORT){ if(gl2ps->sort == GL2PS_SIMPLE_SORT){
prim->verts[0].xyz[2] -= (maxZ - minZ) / 25.0F; prim->verts[0].xyz[2] -= simple * 20.0F;
prim->verts[1].xyz[2] -= (maxZ - minZ) / 25.0F; prim->verts[1].xyz[2] -= simple * 20.0F;
} }
else{ else{
prim->verts[0].xyz[2] -= (maxZ - minZ) / 500.0F; prim->verts[0].xyz[2] -= simple;
prim->verts[1].xyz[2] -= (maxZ - minZ) / 500.0F; prim->verts[1].xyz[2] -= simple;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment