|
From: <kin...@us...> - 2004-02-10 09:30:08
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762/test Modified Files: off2eps.c soid.c tps.c Log Message: final debugging Index: off2eps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/off2eps.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** off2eps.c 10 Feb 2004 04:42:19 -0000 1.4 --- off2eps.c 10 Feb 2004 09:26:53 -0000 1.5 *************** *** 35,39 **** Nrrd *nmap; FILE *file; ! int wire, concave, describe; mop = airMopNew(); --- 35,39 ---- Nrrd *nmap; FILE *file; ! int wire, concave, describe, reverse; mop = airMopNew(); *************** *** 68,71 **** --- 68,74 ---- "use slightly buggy rendering method suitable for " "concave or self-occluding objects"); + hestOptAdd(&hopt, "reverse", NULL, airTypeInt, 0, 0, &reverse, NULL, + "reverse ordering of vertices per face (needed if they " + "specified in clockwise order)"); hestOptAdd(&hopt, "describe", NULL, airTypeInt, 0, 0, &describe, NULL, "for debugging: list object definition of OFF read"); *************** *** 117,120 **** --- 120,135 ---- fprintf(stdout, "----------------- POST-READ -----------------\n"); } + if (reverse) { + if (limnObjectFaceReverse(obj)) { + airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); + fprintf(stderr, "%s: trouble:\n%s\n", me, err); + airMopError(mop); return 1; + } + } + if (describe) { + fprintf(stdout, "----------------- POST-REVERSE -----------------\n"); + limnObjectDescribe(stdout, obj); + fprintf(stdout, "----------------- POST-REVERSE -----------------\n"); + } win = limnWindowNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; Index: soid.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/soid.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** soid.c 10 Feb 2004 04:42:19 -0000 1.8 --- soid.c 10 Feb 2004 09:26:53 -0000 1.9 *************** *** 54,63 **** char *me, *err, *outS; float p[3], q[4], mR[9], eval[3], len, sh, cl, cp, qA, qB; ! float matA[16], matB[16], os, rad, edgeWidth[5]; hestOpt *hopt=NULL; airArray *mop; limnObject *obj; limnLook *look; int lookRod, lookSoid; ! limnPart *part; int partIdx; int res, axis, sphere; FILE *file; --- 54,63 ---- char *me, *err, *outS; float p[3], q[4], mR[9], eval[3], len, sh, cl, cp, qA, qB; ! float matA[16], matB[16], os, rad, edgeWidth[5], AB[2]; hestOpt *hopt=NULL; airArray *mop; limnObject *obj; limnLook *look; int lookRod, lookSoid; ! limnPart *part; int partIdx=-1; /* sssh */ int res, axis, sphere; FILE *file; *************** *** 70,73 **** --- 70,77 ---- hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, eval, "1 1 1", "axis-aligned scaling to do on ellipsoid"); + hestOptAdd(&hopt, "AB", "A, B exponents", airTypeFloat, 2, 2, AB, "nan nan", + "Directly set the A, B parameters to the superquadric surface, " + "over-riding the default behavior of determining them from the " + "scalings \"-sc\" as superquadric tensor glyphs"); hestOptAdd(&hopt, "os", "over-all scaling", airTypeFloat, 1, 1, &os, "1", "over-all scaling (multiplied by scalings)"); *************** *** 113,132 **** washQtoM3(mR, q); ! ELL_3V_SCALE(eval, os, eval); ! ELL_SORT3(eval[0], eval[1], eval[2], cl); ! cl = (eval[0] - eval[1])/(eval[0] + eval[1] + eval[2]); ! cp = 2*(eval[1] - eval[2])/(eval[0] + eval[1] + eval[2]); ! if (cl > cp) { ! axis = ELL_MAX3_IDX(eval[0], eval[1], eval[2]); ! qA = pow(1-cp, sh); ! qB = pow(1-cl, sh); } else { ! axis = ELL_MIN3_IDX(eval[0], eval[1], eval[2]); ! qA = pow(1-cl, sh); ! qB = pow(1-cp, sh); } - fprintf(stderr, "eval = %g %g %g -> cl=%g %s cp=%g -> axis = %d\n", - eval[0], eval[1], eval[2], cl, cl > cp ? ">" : "<", cp, axis); - if (sphere) { partIdx = limnObjectPolarSphereAdd(obj, lookSoid, --- 117,143 ---- washQtoM3(mR, q); ! if (AIR_EXISTS(AB[0]) && AIR_EXISTS(AB[1])) { ! qA = AB[0]; ! qB = AB[1]; ! axis = 2; } else { ! ELL_3V_SCALE(eval, os, eval); ! ELL_SORT3(eval[0], eval[1], eval[2], cl); ! cl = (eval[0] - eval[1])/(eval[0] + eval[1] + eval[2]); ! cp = 2*(eval[1] - eval[2])/(eval[0] + eval[1] + eval[2]); ! if (cl > cp) { ! axis = ELL_MAX3_IDX(eval[0], eval[1], eval[2]); ! qA = pow(1-cp, sh); ! qB = pow(1-cl, sh); ! } else { ! axis = ELL_MIN3_IDX(eval[0], eval[1], eval[2]); ! qA = pow(1-cl, sh); ! qB = pow(1-cp, sh); ! } ! /* ! fprintf(stderr, "eval = %g %g %g -> cl=%g %s cp=%g -> axis = %d\n", ! eval[0], eval[1], eval[2], cl, cl > cp ? ">" : "<", cp, axis); ! */ } if (sphere) { partIdx = limnObjectPolarSphereAdd(obj, lookSoid, Index: tps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/tps.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tps.c 9 Feb 2004 22:48:01 -0000 1.10 --- tps.c 10 Feb 2004 09:26:53 -0000 1.11 *************** *** 27,31 **** char *me, *err, *outS; limnCamera *cam; ! float matA[16], matB[16]; hestOpt *hopt=NULL; airArray *mop; --- 27,31 ---- char *me, *err, *outS; limnCamera *cam; ! float matA[16], matB[16], winscale, edgeWidth[5]; hestOpt *hopt=NULL; airArray *mop; *************** *** 33,37 **** limnLook *look; int lookIdx; limnWindow *win; ! int partIdx; Nrrd *nmap; --- 33,37 ---- limnLook *look; int lookIdx; limnWindow *win; ! int partIdx, wire, concave; Nrrd *nmap; *************** *** 58,61 **** --- 58,73 ---- "16checker-based environment map", NULL, NULL, nrrdHestNrrd); + hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale, + "200", "world to points (PostScript) scaling"); + hestOptAdd(&hopt, "wire", NULL, airTypeInt, 0, 0, &wire, NULL, + "just do wire-frame rendering"); + hestOptAdd(&hopt, "concave", NULL, airTypeInt, 0, 0, &concave, NULL, + "use slightly buggy rendering method suitable for " + "concave or self-occluding objects"); + hestOptAdd(&hopt, "wd", "5 widths", airTypeFloat, 5, 5, edgeWidth, + "0.0 0.0 3.0 2.0 0.0", + "width of edges drawn for five kinds of " + "edges: back non-crease, back crease, " + "silohuette, front crease, front non-crease"); hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps", "output file to render postscript into"); *************** *** 89,92 **** --- 101,105 ---- look->spow = 0; + /* X axis: rod */ partIdx = limnObjectCylinderAdd(obj, 0, 0, 16); ELL_4M_IDENTITY_SET(matA); *************** *** 95,98 **** --- 108,112 ---- limnObjectPartTransform(obj, partIdx, matA); + /* Y axis: rod + ball */ partIdx = limnObjectCylinderAdd(obj, 0, 1, 16); ELL_4M_IDENTITY_SET(matA); *************** *** 101,110 **** limnObjectPartTransform(obj, partIdx, matA); - partIdx = limnObjectCylinderAdd(obj, 0, 2, 16); - ELL_4M_IDENTITY_SET(matA); - ELL_4M_SCALE_SET(matB, 0.2, 0.2, 1); ell_4m_post_mul_f(matA, matB); - ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 1.3); ell_4m_post_mul_f(matA, matB); - limnObjectPartTransform(obj, partIdx, matA); - partIdx = limnObjectPolarSphereAdd(obj, 0, 0, 32, 16); ELL_4M_IDENTITY_SET(matA); --- 115,118 ---- *************** *** 113,116 **** --- 121,131 ---- limnObjectPartTransform(obj, partIdx, matA); + /* Z axis: rod + ball + ball */ + partIdx = limnObjectCylinderAdd(obj, 0, 2, 16); + ELL_4M_IDENTITY_SET(matA); + ELL_4M_SCALE_SET(matB, 0.2, 0.2, 1); ell_4m_post_mul_f(matA, matB); + ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 1.3); ell_4m_post_mul_f(matA, matB); + limnObjectPartTransform(obj, partIdx, matA); + partIdx = limnObjectPolarSphereAdd(obj, 0, 1, 32, 16); ELL_4M_IDENTITY_SET(matA); *************** *** 126,129 **** --- 141,151 ---- win = limnWindowNew(limnDevicePS); + win->scale = winscale; + win->ps.wireFrame = wire; + win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; + win->ps.lineWidth[limnEdgeTypeBackCrease] = edgeWidth[1]; + win->ps.lineWidth[limnEdgeTypeContour] = edgeWidth[2]; + win->ps.lineWidth[limnEdgeTypeFrontCrease] = edgeWidth[3]; + win->ps.lineWidth[limnEdgeTypeFrontFacet] = edgeWidth[4]; win->file = fopen(outS, "w"); *************** *** 131,135 **** if (limnObjectRender(obj, cam, win) ! || limnObjectPSDraw(obj, cam, nmap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); --- 153,159 ---- if (limnObjectRender(obj, cam, win) ! || (concave ! ? limnObjectPSDrawConcave(obj, cam, nmap, win) ! : limnObjectPSDraw(obj, cam, nmap, win))) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); |