'subdivide first' option in rug (does not work well)

This commit is contained in:
Zeno Rogue 2018-02-27 19:27:20 +01:00
parent c251f7cf30
commit 884c1b6455
1 changed files with 14 additions and 7 deletions

21
rug.cpp
View File

@ -17,6 +17,10 @@ struct rug_exception { };
bool fast_euclidean = true; bool fast_euclidean = true;
bool good_shape; bool good_shape;
bool subdivide_first = false;
bool subdivide_further();
void subdivide();
ld modelscale = 1; ld modelscale = 1;
ld model_distance = 2; ld model_distance = 2;
@ -586,8 +590,13 @@ void buildRug() {
printf("vertices = %d triangles= %d\n", size(points), size(triangles)); printf("vertices = %d triangles= %d\n", size(points), size(triangles));
calcLengths(); if(subdivide_first)
for(int i=0; i<20 && subdivide_further(); i++)
subdivide();
sort(points.begin(), points.end(), psort); sort(points.begin(), points.end(), psort);
calcLengths();
verify(); verify();
@ -1715,15 +1724,13 @@ int rugArgs() {
rug::init(); rug::init();
} }
#if CAP_ODS else if(argis("-sdfoff")) {
else if(argis("-ods")) { subdivide_first = false;
ods = true;
} }
else if(argis("-ipd")) { else if(argis("-sdfon")) {
shift(); ipd = argf(); subdivide_first = true;
} }
#endif
else return 1; else return 1;
return 0; return 0;