From a9a5eaf59d5133024d4b79d9adc419b77c3d56a1 Mon Sep 17 00:00:00 2001 From: Trammell hudson Date: Wed, 28 Feb 2018 22:23:40 -0500 Subject: [PATCH] scale and flip --- hiddenwire.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hiddenwire.c b/hiddenwire.c index bf1898e..17ee2b7 100644 --- a/hiddenwire.c +++ b/hiddenwire.c @@ -2,6 +2,8 @@ * Render a hidden wireframe version of an STL file. * */ +// ./hiddenwire --no-hidden --prune 1 -v < nyc-50000.stl --camera 400,60,-600 --lookat 450,0,-800 --up 0,1,0 --fov 20 > test3.svg + #include #include #include @@ -102,11 +104,12 @@ svg_line( float thick ) { + // invert the sense of y printf("\n", p1[0], - p1[1], + -p1[1], p2[0], - p2[1], + -p2[1], color, thick ); @@ -875,8 +878,8 @@ int main( printf("\n", width, height, width, height); - float off_x = 0; // width/2; - float off_y = 0; // height/2; + float off_x = width/2; + float off_y = height/2; printf("\n", off_x, off_y); int rejected = 0; @@ -907,6 +910,10 @@ int main( behind++; goto reject_early; } + + s[j].p[0] *= width; + s[j].p[1] *= width; + s[j].p[2] *= width; } if(debug >= 2) @@ -922,6 +929,7 @@ int main( ); } + tri_t * const tri = tri_new(s, stl->p); // reject this face if any of the vertices are behind us