add bouding-box export
This commit is contained in:
parent
992c98cfa8
commit
7cefa36d62
@ -17,6 +17,43 @@
|
|||||||
|
|
||||||
int verbosity;
|
int verbosity;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------- */
|
||||||
|
/* EXPERIMENTAL GRUIK-CODE !!! */
|
||||||
|
int printf_the_boudingbox(EdgesAndVertices *eav)
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
double x, y, z;
|
||||||
|
double minX, minY, minZ;
|
||||||
|
double maxX, maxY, maxZ;
|
||||||
|
|
||||||
|
minX = minY = minZ = 1e35;
|
||||||
|
maxX = maxY = maxZ = -1e35;
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, ">>> %s ( %p )\n", __func__, eav);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fprintf(stderr, "====== %s is not fully implemented ======\n", __func__);
|
||||||
|
|
||||||
|
for (idx=0; idx<eav->Blist->fidx; idx++) {
|
||||||
|
x = eav->Blist->bbs[idx].p.x;
|
||||||
|
y = eav->Blist->bbs[idx].p.y;
|
||||||
|
z = eav->Blist->bbs[idx].p.z;
|
||||||
|
|
||||||
|
if (x < minX) minX = x;
|
||||||
|
else if (x > maxX) maxX = x;
|
||||||
|
if (y < minY) minY = y;
|
||||||
|
else if (y > maxY) maxY = y;
|
||||||
|
if (z < minZ) minZ = z;
|
||||||
|
else if (z > maxZ) maxZ = z;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "%.9f %.9f %.9f %.9f %.9f %.9f\n",
|
||||||
|
minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
/* EXPERIMENTAL GRUIK-CODE !!! */
|
/* EXPERIMENTAL GRUIK-CODE !!! */
|
||||||
int printf_the_vertices(EdgesAndVertices *eav)
|
int printf_the_vertices(EdgesAndVertices *eav)
|
||||||
@ -101,12 +138,16 @@ if (verbosity > 1) {
|
|||||||
mode = 666;
|
mode = 666;
|
||||||
if (! strcasecmp("edges", outmode)) { mode = 0; }
|
if (! strcasecmp("edges", outmode)) { mode = 0; }
|
||||||
else if (! strcasecmp("vertices", outmode)) { mode = 1; }
|
else if (! strcasecmp("vertices", outmode)) { mode = 1; }
|
||||||
|
else if (! strcasecmp("bbox", outmode)) { mode = 2; }
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0:
|
case 0:
|
||||||
printf_the_edges(&eav); break;
|
printf_the_edges(&eav); break;
|
||||||
case 1:
|
case 1:
|
||||||
printf_the_vertices(&eav); break;
|
printf_the_vertices(&eav); break;
|
||||||
|
case 2:
|
||||||
|
printf_the_boudingbox(&eav); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "no way to do '%s'\n", outmode);
|
fprintf(stderr, "no way to do '%s'\n", outmode);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -141,10 +182,11 @@ while ((opt = getopt(argc, argv, "ht:v")) != -1) {
|
|||||||
case 'v':
|
case 'v':
|
||||||
verbosity++; break;
|
verbosity++; break;
|
||||||
case 't':
|
case 't':
|
||||||
fprintf(stderr, "type -> '%s'\n", optarg);
|
// fprintf(stderr, "type -> '%s'\n", optarg);
|
||||||
outmode = optarg;
|
outmode = optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
fprintf(stderr, "'%c' EBADOPT\n", opt);
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user