You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2004-02-13 23:07:22
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30258 Modified Files: miter.c mrender.c pprobe.c qbert.c ungantry.c vprobe.c Log Message: changes in various libraries Index: miter.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/miter.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** miter.c 7 Jan 2004 15:34:28 -0000 1.21 --- miter.c 13 Feb 2004 23:01:12 -0000 1.22 *************** *** 48,53 **** hparm->respFileEnable = AIR_TRUE; ! hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(muu->nin), NULL, ! "input nrrd to render", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "txf", "nin", airTypeOther, 1, -1, &(muu->ntxf), NULL, "one or more transfer functions", --- 48,53 ---- hparm->respFileEnable = AIR_TRUE; ! hestOptAdd(&hopt, "i", "nsin", airTypeOther, 1, 1, &(muu->nsin), NULL, ! "input scalar volume to render", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "txf", "nin", airTypeOther, 1, -1, &(muu->ntxf), NULL, "one or more transfer functions", *************** *** 137,142 **** } ! nrrdAxisInfoGet_nva(muu->nin, nrrdAxisInfoSize, muu->hctx->volSize); ! nrrdAxisInfoGet_nva(muu->nin, nrrdAxisInfoSpacing, muu->hctx->volSpacing); muu->hctx->user = muu; muu->hctx->renderBegin = (hooverRenderBegin_t *)miteRenderBegin; --- 137,142 ---- } ! nrrdAxisInfoGet_nva(muu->nsin, nrrdAxisInfoSize, muu->hctx->volSize); ! nrrdAxisInfoGet_nva(muu->nsin, nrrdAxisInfoSpacing, muu->hctx->volSpacing); muu->hctx->user = muu; muu->hctx->renderBegin = (hooverRenderBegin_t *)miteRenderBegin; Index: mrender.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/mrender.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mrender.c 7 Jan 2004 15:34:28 -0000 1.28 --- mrender.c 13 Feb 2004 23:01:12 -0000 1.29 *************** *** 111,115 **** biffAdd(MREND, err); return 1; } ! if (1 != gageKindScl->ansLength[uu->whatq]) { sprintf(err, "%s: quantity %s isn't a scalar; can't render it\n", me, airEnumStr(gageKindScl->enm, uu->whatq)); --- 111,115 ---- biffAdd(MREND, err); return 1; } ! if (1 != gageKindScl->table[uu->whatq].answerLength) { sprintf(err, "%s: quantity %s isn't a scalar; can't render it\n", me, airEnumStr(gageKindScl->enm, uu->whatq)); *************** *** 173,177 **** uu->ksp[gageKernel22]->kernel, uu->ksp[gageKernel22]->parm); ! if (!E) E |= gageQuerySet(uu->gctx0, pvl, 1 << uu->whatq); if (!E) E |= gageUpdate(uu->gctx0); if (E) { --- 173,177 ---- uu->ksp[gageKernel22]->kernel, uu->ksp[gageKernel22]->parm); ! if (!E) E |= gageQueryItemOn(uu->gctx0, pvl, uu->whatq); if (!E) E |= gageUpdate(uu->gctx0); if (E) { *************** *** 365,369 **** len = 0; for (i=airEnumUnknown(gageScl)+1; !airEnumValCheck(gageScl, i); i++) { ! if (1 == gageKindScl->ansLength[i]) { line = airEnumFmtDesc(gageScl, i, AIR_FALSE, "\n \b\bo \"%s\": %s"); len += strlen(line); --- 365,369 ---- len = 0; for (i=airEnumUnknown(gageScl)+1; !airEnumValCheck(gageScl, i); i++) { ! if (1 == gageKindScl->table[i].answerLength) { line = airEnumFmtDesc(gageScl, i, AIR_FALSE, "\n \b\bo \"%s\": %s"); len += strlen(line); *************** *** 376,380 **** /* 2nd pass through: create output */ for (i=airEnumUnknown(gageScl)+1; !airEnumValCheck(gageScl, i); i++) { ! if (1 == gageKindScl->ansLength[i]) { line = airEnumFmtDesc(gageScl, i, AIR_FALSE, "\n \b\bo \"%s\": %s"); strcat(ret, line); --- 376,380 ---- /* 2nd pass through: create output */ for (i=airEnumUnknown(gageScl)+1; !airEnumValCheck(gageScl, i); i++) { ! if (1 == gageKindScl->table[i].answerLength) { line = airEnumFmtDesc(gageScl, i, AIR_FALSE, "\n \b\bo \"%s\": %s"); strcat(ret, line); Index: pprobe.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/pprobe.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pprobe.c 7 Jan 2004 15:34:28 -0000 1.10 --- pprobe.c 13 Feb 2004 23:01:12 -0000 1.11 *************** *** 146,151 **** } ! ansLen = kind->ansLength[what]; ! iBaseDim = gageKindScl == kind ? 0 : 1; nin->axis[0+iBaseDim].spacing = SPACING(nin->axis[0+iBaseDim].spacing); nin->axis[1+iBaseDim].spacing = SPACING(nin->axis[1+iBaseDim].spacing); --- 146,151 ---- } ! ansLen = kind->table[what].answerLength; ! iBaseDim = kind->baseDim; nin->axis[0+iBaseDim].spacing = SPACING(nin->axis[0+iBaseDim].spacing); nin->axis[1+iBaseDim].spacing = SPACING(nin->axis[1+iBaseDim].spacing); *************** *** 164,168 **** if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! if (!E) E |= gageQuerySet(ctx, pvl, 1 << what); if (!E) E |= gageUpdate(ctx); if (E) { --- 164,168 ---- if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! if (!E) E |= gageQueryItemOn(ctx, pvl, what); if (!E) E |= gageUpdate(ctx); if (E) { Index: qbert.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/qbert.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** qbert.c 9 Feb 2004 07:21:14 -0000 1.19 --- qbert.c 13 Feb 2004 23:01:12 -0000 1.20 *************** *** 192,196 **** gage_t *val, *gmag, *scnd; float *vghF; ! int E, i, j, k, query; airArray *mop; --- 192,196 ---- gage_t *val, *gmag, *scnd; float *vghF; ! int E, i, j, k; airArray *mop; *************** *** 219,227 **** if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! query = (1 << gageSclValue) | (1 << gageSclGradMag); if (doH) { ! query |= (1 << gageScl2ndDD); } - if (!E) E |= gageQuerySet(ctx, pvl, query); if (!E) E |= gageUpdate(ctx); if (E) { --- 219,227 ---- if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! if (!E) E |= gageQueryItemOn(ctx, pvl, gageSclValue); ! if (!E) E |= gageQueryItemOn(ctx, pvl, gageSclGradMag); if (doH) { ! if (!E) E |= gageQueryItemOn(ctx, pvl, gageScl2ndDD); } if (!E) E |= gageUpdate(ctx); if (E) { Index: ungantry.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/ungantry.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ungantry.c 7 Jan 2004 15:34:28 -0000 1.8 --- ungantry.c 13 Feb 2004 23:01:12 -0000 1.9 *************** *** 105,109 **** if (!E) E |= gageKernelSet(ctx, gageKernel00, gantric->kernel, gantric->parm); ! if (!E) E |= gageQuerySet(ctx, pvl, 1 << gageSclValue); if (!E) E |= gageUpdate(ctx); if (E) { --- 105,109 ---- if (!E) E |= gageKernelSet(ctx, gageKernel00, gantric->kernel, gantric->parm); ! if (!E) E |= gageQueryItemOn(ctx, pvl, gageSclValue); if (!E) E |= gageUpdate(ctx); if (E) { Index: vprobe.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/vprobe.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** vprobe.c 7 Jan 2004 15:34:28 -0000 1.19 --- vprobe.c 13 Feb 2004 23:01:12 -0000 1.20 *************** *** 143,148 **** } ! ansLen = kind->ansLength[what]; ! iBaseDim = gageKindScl == kind ? 0 : 1; oBaseDim = 1 == ansLen ? 0 : 1; six = nin->axis[0+iBaseDim].size; --- 143,148 ---- } ! ansLen = kind->table[what].answerLength; ! iBaseDim = kind->baseDim; oBaseDim = 1 == ansLen ? 0 : 1; six = nin->axis[0+iBaseDim].size; *************** *** 173,177 **** if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! if (!E) E |= gageQuerySet(ctx, pvl, 1 << what); if (!E) E |= gageUpdate(ctx); if (E) { --- 173,177 ---- if (!E) E |= gageKernelSet(ctx, gageKernel11, k11->kernel, k11->parm); if (!E) E |= gageKernelSet(ctx, gageKernel22, k22->kernel, k22->parm); ! if (!E) E |= gageQueryItemOn(ctx, pvl, what); if (!E) E |= gageUpdate(ctx); if (E) { |
|
From: <kin...@us...> - 2004-02-13 23:06:14
|
Update of /cvsroot/teem/teem/src/ten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30035 Modified Files: enumsTen.c fiberMethods.c glyph.c ten.h tenGage.c tendGlyph.c Log Message: should be no external changes- various things needed to reflect changes in limn and gage Index: enumsTen.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/enumsTen.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** enumsTen.c 7 Jan 2004 15:34:31 -0000 1.13 --- enumsTen.c 13 Feb 2004 23:00:08 -0000 1.14 *************** *** 67,72 **** "trace", "frob", ! "eigenvalues", ! "eigenvectors", "tensor gradient", "Q anisotropy", --- 67,76 ---- "trace", "frob", ! "eigenvalue0", ! "eigenvalue1", ! "eigenvalue2", ! "eigenvector0", ! "eigenvector1", ! "eigenvector2", "tensor gradient", "Q anisotropy", *************** *** 87,92 **** "tensor trace", "frob(tensor)", ! "tensor eigenvalues", ! "tensor eigenvectors", "tensor gradient", "Q anisotropy", --- 91,100 ---- "tensor trace", "frob(tensor)", ! "tensor eigenvalue 0", ! "tensor eigenvalue 1", ! "tensor eigenvalue 2", ! "tensor eigenvector 0", ! "tensor eigenvector 1", ! "tensor eigenvector 2", "tensor gradient", "Q anisotropy", *************** *** 107,112 **** tenGageTrace, tenGageFrobTensor, ! tenGageEval, ! tenGageEvec, tenGageTensorGrad, tenGageQ, --- 115,124 ---- tenGageTrace, tenGageFrobTensor, ! tenGageEval0, ! tenGageEval1, ! tenGageEval2, ! tenGageEvec0, ! tenGageEvec1, ! tenGageEvec2, tenGageTensorGrad, tenGageQ, *************** *** 124,129 **** #define TG_TR tenGageTrace #define TG_FT tenGageFrobTensor ! #define TG_AL tenGageEval ! #define TG_EC tenGageEvec #define TG_TG tenGageTensorGrad #define TG_Q tenGageQ --- 136,145 ---- #define TG_TR tenGageTrace #define TG_FT tenGageFrobTensor ! #define TG_AL0 tenGageEval0 ! #define TG_AL1 tenGageEval1 ! #define TG_AL2 tenGageEval2 ! #define TG_EC0 tenGageEvec0 ! #define TG_EC1 tenGageEvec1 ! #define TG_EC2 tenGageEvec2 #define TG_TG tenGageTensorGrad #define TG_Q tenGageQ *************** *** 142,147 **** "tr", "trace", "frt", "fro", "frob", "frobt", ! "eval", "eigenvalues", ! "evec", "eigenvectors", "tg", "tgrad", "t grad", "tensor gradient", "q", --- 158,167 ---- "tr", "trace", "frt", "fro", "frob", "frobt", ! "eval0", "eigenvalue0", ! "eval1", "eigenvalue1", ! "eval2", "eigenvalue2", ! "evec0", "eigenvector0", ! "evec1", "eigenvector1", ! "evec2", "eigenvector2", "tg", "tgrad", "t grad", "tensor gradient", "q", *************** *** 162,167 **** TG_TR, TG_TR, TG_FT, TG_FT, TG_FT, TG_FT, ! TG_AL, TG_AL, ! TG_EC, TG_EC, TG_TG, TG_TG, TG_TG, TG_TG, TG_Q, --- 182,191 ---- TG_TR, TG_TR, TG_FT, TG_FT, TG_FT, TG_FT, ! TG_AL0, TG_AL0, ! TG_AL1, TG_AL1, ! TG_AL2, TG_AL2, ! TG_EC0, TG_EC0, ! TG_EC1, TG_EC1, ! TG_EC2, TG_EC2, TG_TG, TG_TG, TG_TG, TG_TG, TG_Q, *************** *** 179,183 **** _tenGage = { "tenGage", ! TEN_GAGE_MAX+1, _tenGageStr, _tenGageVal, _tenGageDesc, --- 203,207 ---- _tenGage = { "tenGage", ! TEN_GAGE_ITEM_MAX+1, _tenGageStr, _tenGageVal, _tenGageDesc, Index: fiberMethods.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/fiberMethods.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** fiberMethods.c 16 Jan 2004 17:35:12 -0000 1.13 --- fiberMethods.c 13 Feb 2004 23:00:08 -0000 1.14 *************** *** 98,105 **** tfx->stop = 0; ! tfx->query = 0; tfx->dten = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageTensor); ! tfx->eval = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageEval); ! tfx->evec = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageEvec); tfx->aniso = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageAniso); } --- 98,105 ---- tfx->stop = 0; ! GAGE_QUERY_RESET(tfx->query); tfx->dten = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageTensor); ! tfx->eval = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageEval0); ! tfx->evec = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageEvec0); tfx->aniso = gageAnswerPointer(tfx->gtx, tfx->gtx->pvl[0], tenGageAniso); } *************** *** 119,134 **** switch(type) { case tenFiberTypeEvec1: ! tfx->query |= (1 << tenGageEvec); break; case tenFiberTypeTensorLine: ! tfx->query |= ((1 << tenGageTensor) ! | (1 << tenGageEval) /* we'll compute c_l by hand */ ! | (1 << tenGageEvec)); break; case tenFiberTypePureLine: ! tfx->query |= (1 << tenGageTensor); break; case tenFiberTypeZhukov: ! sprintf(err, "%s: sorry, not Zhukov oriented tensors implemented", me); biffAdd(TEN, err); return 1; break; --- 119,138 ---- switch(type) { case tenFiberTypeEvec1: ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEvec0); break; case tenFiberTypeTensorLine: ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageTensor); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEval0); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEval1); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEval2); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEvec0); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEvec1); ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageEvec2); break; case tenFiberTypePureLine: ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageTensor); break; case tenFiberTypeZhukov: ! sprintf(err, "%s: sorry, Zhukov oriented tensors not implemented", me); biffAdd(TEN, err); return 1; break; *************** *** 181,185 **** biffAdd(TEN, err); ret = 1; goto end; } ! tfx->query |= (1 << tenGageAniso); break; case tenFiberStopLength: --- 185,189 ---- biffAdd(TEN, err); ret = 1; goto end; } ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageAniso); break; case tenFiberStopLength: *************** *** 205,209 **** biffAdd(TEN, err); ret = 1; goto end; } ! tfx->query |= (1 << tenGageTensor); break; case tenFiberStopBounds: --- 209,213 ---- biffAdd(TEN, err); ret = 1; goto end; } ! GAGE_QUERY_ITEM_ON(tfx->query, tenGageTensor); break; case tenFiberStopBounds: Index: glyph.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/glyph.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** glyph.c 7 Jan 2004 15:34:31 -0000 1.31 --- glyph.c 13 Feb 2004 23:00:08 -0000 1.32 *************** *** 158,162 **** int ! tenGlyphGen(limnObj *glyphsLimn, echoScene *glyphsEcho, tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc) { char me[]="tenGlyphGen", err[AIR_STRLEN_MED]; --- 158,162 ---- int ! tenGlyphGen(limnObject *glyphsLimn, echoScene *glyphsEcho, tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc) { char me[]="tenGlyphGen", err[AIR_STRLEN_MED]; *************** *** 167,173 **** aniso[TEN_ANISO_MAX+1], sRot[16], mA[16], mB[16], R, G, B, qA, qB, glyphAniso, sliceGray; ! int slcCoord[3], slcIdx, idx, _idx=0, ri, axis, spi=0, numGlyphs, duh; ! limnPart *lglyph; ! limnSP *sp; echoObject *eglyph, *inst, *list=NULL, *split, *esquare; echoPos_t eM[16], originOffset[3], edge0[3], edge1[3]; --- 167,172 ---- aniso[TEN_ANISO_MAX+1], sRot[16], mA[16], mB[16], R, G, B, qA, qB, glyphAniso, sliceGray; ! int slcCoord[3], idx, _idx=0, glyphIdx, axis, numGlyphs, duh; ! limnLook *look; int lookIdx; echoObject *eglyph, *inst, *list=NULL, *split, *esquare; echoPos_t eM[16], originOffset[3], edge0[3], edge1[3]; *************** *** 241,254 **** } if (glyphsLimn) { ! /* create limnSPs for diffuse (#0) and flat (#1) shading */ ! spi = airArrayIncrLen(glyphsLimn->sA, 2); ! sp = glyphsLimn->s + spi + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ! ELL_3V_SET(sp->k, 0, 1, 0); ! sp->spec = 0; ! sp = glyphsLimn->s + spi + 1; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ! ELL_3V_SET(sp->k, 1, 0, 0); ! sp->spec = 0; } if (glyphsEcho) { --- 240,244 ---- } if (glyphsLimn) { ! /* create limnLooks for diffuse and ambient-only shading */ } if (glyphsEcho) { *************** *** 287,292 **** } ELL_3V_COPY(slcCoord, pI); ! slcIdx = slcCoord[0] + nslc->axis[0].size*slcCoord[1]; ! sliceGray = nrrdFLookup[nslc->type](nslc->data, slcIdx); } else { if (!( tdata[0] >= parm->confThresh )) --- 277,283 ---- } ELL_3V_COPY(slcCoord, pI); ! sliceGray = ! nrrdFLookup[nslc->type](nslc->data, ! slcCoord[0] + nslc->axis[0].size*slcCoord[1]); } else { if (!( tdata[0] >= parm->confThresh )) *************** *** 304,308 **** /* make slice contribution */ if (glyphsLimn) { ! ri = limnObjSquareAdd(glyphsLimn, spi + 1); ELL_4M_IDENTITY_SET(mA); ell_4m_post_mul_f(mA, sRot); --- 295,304 ---- /* make slice contribution */ if (glyphsLimn) { ! lookIdx = limnObjectLookAdd(glyphsLimn); ! look = glyphsLimn->look + lookIdx; ! ELL_4V_SET(look->rgba, sliceGray, sliceGray, sliceGray, 1); ! ELL_3V_SET(look->kads, 1, 0, 0); ! look->spow = 0; ! glyphIdx = limnObjectSquareAdd(glyphsLimn, lookIdx); ELL_4M_IDENTITY_SET(mA); ell_4m_post_mul_f(mA, sRot); *************** *** 321,327 **** originOffset[2]); ell_4m_post_mul_f(mA, mB); ! lglyph = glyphsLimn->r + ri; ! ELL_4V_SET(lglyph->rgba, sliceGray, sliceGray, sliceGray, 1); ! limnObjPartTransform(glyphsLimn, ri, mA); } if (glyphsEcho) { --- 317,321 ---- originOffset[2]); ell_4m_post_mul_f(mA, mB); ! limnObjectPartTransform(glyphsLimn, glyphIdx, mA); } if (glyphsEcho) { *************** *** 405,428 **** /* add the glyph */ if (glyphsLimn) { switch(parm->glyphType) { case tenGlyphTypeBox: ! ri = limnObjCubeAdd(glyphsLimn, spi + 0); break; case tenGlyphTypeSphere: ! ri = limnObjPolarSphereAdd(glyphsLimn, spi + 0, axis, ! 2*parm->facetRes, parm->facetRes); break; case tenGlyphTypeCylinder: ! ri = limnObjCylinderAdd(glyphsLimn, spi + 0, axis, parm->facetRes); break; case tenGlyphTypeSuperquad: default: ! ri = limnObjPolarSuperquadAdd(glyphsLimn, spi + 0, axis, qA, qB, ! 2*parm->facetRes, parm->facetRes); break; } ! lglyph = glyphsLimn->r + ri; ! ELL_4V_SET(lglyph->rgba, R, G, B, 1); ! limnObjPartTransform(glyphsLimn, ri, mA); } if (glyphsEcho) { --- 399,427 ---- /* add the glyph */ if (glyphsLimn) { + lookIdx = limnObjectLookAdd(glyphsLimn); + look = glyphsLimn->look + lookIdx; + ELL_4V_SET(look->rgba, R, G, B, 1); + ELL_3V_SET(look->kads, 0, 1, 0); + look->spow = 0; switch(parm->glyphType) { case tenGlyphTypeBox: ! glyphIdx = limnObjectCubeAdd(glyphsLimn, lookIdx); break; case tenGlyphTypeSphere: ! glyphIdx = limnObjectPolarSphereAdd(glyphsLimn, lookIdx, axis, ! 2*parm->facetRes, parm->facetRes); break; case tenGlyphTypeCylinder: ! glyphIdx = limnObjectCylinderAdd(glyphsLimn, lookIdx, axis, ! parm->facetRes); break; case tenGlyphTypeSuperquad: default: ! glyphIdx = limnObjectPolarSuperquadAdd(glyphsLimn, lookIdx, axis, ! qA, qB, 2*parm->facetRes, ! parm->facetRes); break; } ! limnObjectPartTransform(glyphsLimn, glyphIdx, mA); } if (glyphsEcho) { Index: ten.h =================================================================== RCS file: /cvsroot/teem/teem/src/ten/ten.h,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ten.h 16 Jan 2004 17:35:12 -0000 1.70 --- ten.h 13 Feb 2004 23:00:08 -0000 1.71 *************** *** 110,114 **** int glyphType, facetRes; float glyphScale, sqdSharp; ! float edgeWidth[5]; /* same as limnOptsPS */ /* glyphs are colored by eigenvector colEvec with the standard XYZ-RGB --- 110,114 ---- int glyphType, facetRes; float glyphScale, sqdSharp; ! float edgeWidth[3]; /* 0: contour, 1: front crease, 2: front non-crease */ /* glyphs are colored by eigenvector colEvec with the standard XYZ-RGB *************** *** 153,179 **** tenGageTrace, /* 1: "tr", trace of tensor: *GT */ tenGageFrobTensor, /* 2: "fro", frobenius norm of tensor: *GT */ ! tenGageEval, /* 3: "eval", eigenvalues of tensor ! (sorted descending) : GT[3] */ ! tenGageEvec, /* 4: "evec", eigenvectors of tensor: GT[9] */ ! tenGageTensorGrad, /* 5: "tg", all tensor component gradients, starting with the confidence value gradient: GT[21] */ ! tenGageQ, /* 6: "q", Q anisotropy (or 9 times it): *GT */ ! tenGageQGradVec, /* 7: "qv", gradient of Q anisotropy: GT[3] */ ! tenGageQGradMag, /* 8: "qg", grad mag of Q anisotropy: *GT */ ! tenGageQNormal, /* 9: "qn", normalized gradient of Q anisotropy: GT[3] */ ! tenGageMultiGrad, /* 10: "mg", sum of outer products of the tensor ! matrix elements, correctly counting the off-diagonal entries twice, but not counting the confidence value: GT[9] */ ! tenGageFrobMG, /* 11: "frmg", frobenius norm of multi gradient: *GT */ ! tenGageMGEval, /* 12: "mgeval", eigenvalues of multi gradient: GT[3]*/ ! tenGageMGEvec, /* 13: "mgevec", eigenvectors of multi gradient: GT[9] */ ! tenGageAniso, /* 14: "an", all anisotropies: GT[TEN_ANISO_MAX+1] */ tenGageLast }; ! #define TEN_GAGE_MAX 14 ! #define TEN_GAGE_TOTAL_ANS_LENGTH (72+TEN_ANISO_MAX+1) /* --- 153,181 ---- tenGageTrace, /* 1: "tr", trace of tensor: *GT */ tenGageFrobTensor, /* 2: "fro", frobenius norm of tensor: *GT */ ! tenGageEval0, /* 3: "eval0", major eigenvalue of tensor : *GT */ ! tenGageEval1, /* 4: "eval1", medium eigenvalue of tensor : *GT */ ! tenGageEval2, /* 5: "eval2", minor eigenvalue of tensor : *GT */ ! tenGageEvec0, /* 6: "evec0", major eigenvectors of tensor: GT[3] */ ! tenGageEvec1, /* 7: "evec1", medium eigenvectors of tensor: GT[3] */ ! tenGageEvec2, /* 8: "evec2", minor eigenvectors of tensor: GT[3] */ ! tenGageTensorGrad, /* 9: "tg", all tensor component gradients, starting with the confidence value gradient: GT[21] */ ! tenGageQ, /* 10: "q", Q anisotropy (or 9 times it): *GT */ ! tenGageQGradVec, /* 11: "qv", gradient of Q anisotropy: GT[3] */ ! tenGageQGradMag, /* 12: "qg", grad mag of Q anisotropy: *GT */ ! tenGageQNormal, /* 13: "qn", normalized gradient of Q anisotropy: GT[3] */ ! tenGageMultiGrad, /* 14: "mg", sum of outer products of gradients of ! tensor elements, correctly counting the off-diagonal entries twice, but not counting the confidence value: GT[9] */ ! tenGageFrobMG, /* 15: "frmg", frobenius norm of multi gradient: *GT */ ! tenGageMGEval, /* 16: "mgeval", eigenvalues of multi gradient: GT[3]*/ ! tenGageMGEvec, /* 17: "mgevec", eigenvectors of multi gradient: GT[9] */ ! tenGageAniso, /* 18: "an", all anisotropies: GT[TEN_ANISO_MAX+1] */ tenGageLast }; ! #define TEN_GAGE_ITEM_MAX 18 /* *************** *** 267,272 **** double wPunct; /* knob for tensor lines */ /* ---- internal ----- */ ! int query, /* query we'll send to gageQuerySet */ ! dir; /* current direction being computed (0 or 1) */ double wPos[3], /* current world space location */ wDir[3], /* difference between this and last world space pos */ --- 269,274 ---- double wPunct; /* knob for tensor lines */ /* ---- internal ----- */ ! gageQuery query; /* query we'll send to gageQuerySet */ ! int dir; /* current direction being computed (0 or 1) */ double wPos[3], /* current world space location */ wDir[3], /* difference between this and last world space pos */ *************** *** 353,357 **** extern int tenGlyphParmCheck(tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc); ! extern int tenGlyphGen(limnObj *glyphs, echoScene *scene, tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc); --- 355,359 ---- extern int tenGlyphParmCheck(tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc); ! extern int tenGlyphGen(limnObject *glyphs, echoScene *scene, tenGlyphParm *parm, Nrrd *nten, Nrrd *npos, Nrrd *nslc); Index: tenGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tenGage.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tenGage.c 16 Jan 2004 17:35:12 -0000 1.10 --- tenGage.c 13 Feb 2004 23:00:09 -0000 1.11 *************** *** 22,131 **** #include "privateTen.h" ! /* ! tenGageTensor, * 0: "t", the reconstructed tensor: GT[7] * ! tenGageTrace, * 1: "tr", trace of tensor: *GT * ! tenGageFrobTensor, * 2: "fro", frobenius norm of tensor: *GT * ! tenGageEval, * 3: "eval", eigenvalues of tensor ! (sorted descending) : GT[3] * ! tenGageEvec, * 4: "evec", eigenvectors of tensor: GT[9] * ! tenGageTensorGrad, * 5: "tg", all tensor component gradients, starting ! with the confidence value gradient: GT[21] * ! tenGageQ, * 6: "q", Q anisotropy: *GT * ! tenGageQGradVec, * 7: "qv", gradient of Q anisotropy: GT[3] * ! tenGageQGradMag, * 8: "qg", grad mag of Q anisotropy: *GT * ! tenGageQNormal, * 9: "qn", normalized gradient of Q ! anisotropy: GT[3] * ! tenGageMultiGrad, * 10: "mg", sum of outer products of the tensor ! matrix elements, correctly counting the ! off-diagonal entries twice, but not counting ! the confidence value: GT[9] * ! tenGageFrobMG, * 11: "frmg", frobenius norm of multi gradient: *GT * ! tenGageMGEval, * 12: "mgeval", eigenvalues of multi gradient: GT[3]* ! tenGageMGEvec, * 13: "mgevec", eigenvectors of multi ! gradient: GT[9] * ! tenGageAniso, * 14: "an", all anisotropies: GT[TEN_ANISO_MAX+1] * ! tenGageLast ! ! */ ! ! int ! tenGageAnsLength[TEN_GAGE_MAX+1] = { ! 7, 1, 1, 3, 9, 21, 1, 3, 1, 3, 9, 1, 3, 9, TEN_ANISO_MAX+1 ! }; ! ! int ! tenGageAnsOffset[TEN_GAGE_MAX+1] = { ! 0, 7, 8, 9, 12, 21, 42, 43, 46, 47, 50, 59, 60, 63, 72 ! /* --> 72+TEN_ANISO_MAX+1 == TEN_GAGE_TOTAL_ANS_LENGTH */ ! }; ! ! /* ! ** _tenGageNeedDeriv[] ! ** ! ** each value is a BIT FLAG representing the different value/derivatives ! ** that are needed to calculate the quantity. ! ** ! ** 1: need value interpolation reconstruction (as with k00) ! ** 2: need first derivatives (as with k11) ! ** 4: need second derivatives (as with k22) ! */ ! int ! _tenGageNeedDeriv[TEN_GAGE_MAX+1] = { ! 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1 ! }; ! ! /* ! ** _tenGagePrereq[] ! ** ! ** this records the measurements which are needed as ingredients for any ! ** given measurement, but it is not necessarily the recursive expansion of ! ** that requirement (that role is performed by gageQuerySet()) ! */ ! unsigned int ! _tenGagePrereq[TEN_GAGE_MAX+1] = { ! /* 0: tenGageTensor */ ! 0, ! ! /* 1: tenGageTrace */ ! (1<<tenGageTensor), ! ! /* 2: tenGageFrobTensor */ ! (1<<tenGageTensor), ! ! /* 3: tenGageEval */ ! (1<<tenGageTensor), ! ! /* 4: tenGageEvec */ ! (1<<tenGageTensor), ! ! /* 5: tenGageTensorGrad */ ! 0, ! ! /* 6: tenGageQ */ ! (1<<tenGageTensor), ! ! /* 7: tenGageQGradVec */ ! (1<<tenGageTensor) | (1<<tenGageTensorGrad), ! ! /* 8: tenGageQGradMag */ ! (1<<tenGageQGradVec), ! ! /* 9: tenGageQNormal */ ! (1<<tenGageQGradMag) | (1<<tenGageQGradVec), ! ! /* 10: tenGageMultiGrad */ ! (1<<tenGageTensorGrad), ! ! /* 11: tenGageFrobMG */ ! (1<<tenGageMultiGrad), ! ! /* 12: tenGageMGEval */ ! (1<<tenGageMultiGrad), ! ! /* 13: tenGageMGEvec */ ! (1<<tenGageMultiGrad), ! ! /* 14: tenGageAniso */ ! (1<<tenGageEval) }; --- 22,47 ---- #include "privateTen.h" ! gageItemEntry ! _tenGageTable[GAGE_SCL_ITEM_MAX+1] = { ! /* enum value len,deriv, prereqs, parent item, index*/ ! {tenGageTensor, 7, 0, {-1, -1, -1, -1, -1}, -1, -1}, ! {tenGageTrace, 1, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageFrobTensor, 1, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEval0, 1, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEval1, 1, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEval2, 1, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEvec0, 3, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEvec1, 3, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageEvec2, 3, 0, {tenGageTensor, -1, -1, -1, -1}, -1, -1}, ! {tenGageTensorGrad, 21, 1, {-1, -1, -1, -1, -1}, -1, -1}, ! {tenGageQ, 1, 0, {-1, -1, -1, -1, -1}, -1, -1}, ! {tenGageQGradVec, 3, 1, {tenGageTensor, tenGageTensorGrad, -1, -1, -1}, -1, -1}, ! {tenGageQGradMag, 1, 1, {tenGageQGradVec, -1, -1, -1, -1}, -1, -1}, ! {tenGageQNormal, 3, 1, {tenGageQGradVec, tenGageQGradMag, -1, -1, -1}, -1, -1}, ! {tenGageMultiGrad, 9, 1, {tenGageTensorGrad, -1, -1, -1, -1}, -1, -1}, ! {tenGageFrobMG, 1, 1, {tenGageMultiGrad, -1, -1, -1, -1}, -1, -1}, ! {tenGageMGEval, 3, 1, {tenGageMultiGrad, -1, -1, -1, -1}, -1, -1}, ! {tenGageMGEvec, 9, 1, {tenGageMultiGrad, -1, -1, -1, -1}, -1, -1}, ! {tenGageAniso, TEN_ANISO_MAX+1, 0, {tenGageEval0, tenGageEval1, tenGageEval2, -1, -1}, -1, -1} }; *************** *** 138,148 **** void _tenGageFilter (gageContext *ctx, gagePerVolume *pvl) { ! char me[]="_gageVecFilter"; gage_t *fw00, *fw11, *fw22, *tensor, *tgrad; int fd; fd = GAGE_FD(ctx); ! tensor = GAGE_ANSWER_POINTER(pvl, tenGageTensor); ! tgrad = GAGE_ANSWER_POINTER(pvl, tenGageTensorGrad); if (!ctx->parm.k3pack) { fprintf(stderr, "!%s: sorry, 6pack filtering not implemented\n", me); --- 54,64 ---- void _tenGageFilter (gageContext *ctx, gagePerVolume *pvl) { ! char me[]="_tenGageFilter"; gage_t *fw00, *fw11, *fw22, *tensor, *tgrad; int fd; fd = GAGE_FD(ctx); ! tensor = pvl->directAnswer[tenGageTensor]; ! tgrad = pvl->directAnswer[tenGageTensorGrad]; if (!ctx->parm.k3pack) { fprintf(stderr, "!%s: sorry, 6pack filtering not implemented\n", me); *************** *** 191,198 **** _tenGageAnswer (gageContext *ctx, gagePerVolume *pvl) { /* char me[]="_tenGageAnswer"; */ - unsigned int query; gage_t *ans, *tenAns, *tgradAns, *QgradAns, *evalAns, *evecAns, tmptmp=0, dtA=0, dtB=0, dtC=0, dtD=0, dtE=0, dtF=0, cbA, cbB; ! int *offset; #if !GAGE_TYPE_FLOAT --- 107,113 ---- _tenGageAnswer (gageContext *ctx, gagePerVolume *pvl) { /* char me[]="_tenGageAnswer"; */ gage_t *ans, *tenAns, *tgradAns, *QgradAns, *evalAns, *evecAns, tmptmp=0, dtA=0, dtB=0, dtC=0, dtD=0, dtE=0, dtF=0, cbA, cbB; ! int wantEvals, wantEvecs; #if !GAGE_TYPE_FLOAT *************** *** 201,213 **** #endif ! query = pvl->query; ! ans = pvl->ans; ! offset = tenGageKind->ansOffset; ! tenAns = ans + offset[tenGageTensor]; ! tgradAns = ans + offset[tenGageTensorGrad]; ! QgradAns = ans + offset[tenGageQGradVec]; ! evalAns = ans + offset[tenGageEval]; ! evecAns = ans + offset[tenGageEvec]; ! if (1 & (query >> tenGageTensor)) { /* done if doV */ dtA = tenAns[1]; --- 116,126 ---- #endif ! ans = pvl->answer; ! tenAns = pvl->directAnswer[tenGageTensor]; ! tgradAns = pvl->directAnswer[tenGageTensorGrad]; ! QgradAns = pvl->directAnswer[tenGageQGradVec]; ! evalAns = pvl->directAnswer[tenGageEval0]; ! evecAns = pvl->directAnswer[tenGageEvec0]; ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageTensor)) { /* done if doV */ dtA = tenAns[1]; *************** *** 222,248 **** } } ! if (1 & (query >> tenGageTrace)) { ! ans[offset[tenGageTrace]] = dtA + dtD + dtF; } ! if (1 & (query >> tenGageFrobTensor)) { ! ans[offset[tenGageTrace]] = sqrt(dtA*dtA + 2*dtB*dtB + 2*dtC*dtC ! + dtD*dtD + 2*dtE*dtE + dtF*dtF); } ! /* HEY: this is pretty sub-optimal if the only thing we want is the ! eigenvalues for doing anisotropy determination ... */ ! if ( (1 & (query >> tenGageEval)) || (1 & (query >> tenGageEvec)) ) { #if GAGE_TYPE_FLOAT ! tenEigensolve(evalAns, evecAns, tenAns); #else ! TEN_LIST_COPY(tenAnsF, tenAns); ! tenEigensolve(evalAnsF, evecAnsF, tenAnsF); ! ELL_3V_COPY(evalAns, evalAnsF); ! ELL_3M_COPY(evecAns, evecAnsF); #endif } ! if (1 & (query >> tenGageTensorGrad)) { /* done if doD1 */ } ! if (1 & (query >> tenGageQ)) { cbA = -(dtA + dtD + dtF); cbB = dtA*dtD - dtB*dtB + dtA*dtF - dtC*dtC + dtD*dtF - dtE*dtE; --- 135,177 ---- } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageTrace)) { ! pvl->directAnswer[tenGageTrace][0] = dtA + dtD + dtF; } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageFrobTensor)) { ! pvl->directAnswer[tenGageFrobTensor][0] = sqrt(dtA*dtA + 2*dtB*dtB ! + 2*dtC*dtC + dtD*dtD ! + 2*dtE*dtE + dtF*dtF); } ! wantEvals = ((GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEval0)) || ! (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEval1)) || ! (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEval2))); ! wantEvecs = ((GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEvec0)) || ! (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEvec1)) || ! (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageEvec2))); ! if (wantEvecs) { ! /* we do the longer process to get eigenvectors, and in the process ! we always find the eigenvalues, whether or not they were asked for */ #if GAGE_TYPE_FLOAT ! tenEigensolve(evalAns, evecAns, tenAns); #else ! TEN_LIST_COPY(tenAnsF, tenAns); ! tenEigensolve(evalAnsF, evecAnsF, tenAnsF); ! ELL_3V_COPY(evalAns, evalAnsF); ! ELL_3M_COPY(evecAns, evecAnsF); ! #endif ! } else if (wantEvals) { ! /* else eigenvectors are NOT needed, but eigenvalues ARE needed */ ! #if GAGE_TYPE_FLOAT ! tenEigensolve(evalAns, NULL, tenAns); ! #else ! TEN_LIST_COPY(tenAnsF, tenAns); ! tenEigensolve(evalAnsF, NULL, tenAnsF); ! ELL_3V_COPY(evalAns, evalAnsF); #endif } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageTensorGrad)) { /* done if doD1 */ } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQ)) { cbA = -(dtA + dtD + dtF); cbB = dtA*dtD - dtB*dtB + dtA*dtF - dtC*dtC + dtD*dtF - dtE*dtE; *************** *** 251,257 **** - dtC*dtC*dtD - dtB*dtB*dtF - dtA*dtE*dtE); */ ! ans[offset[tenGageQ]] = cbA*cbA - 3*cbB; } ! if (1 & (query >> tenGageQGradVec)) { ELL_3V_SET(QgradAns, 0, 0, 0); ELL_3V_SCALE_INCR(QgradAns, dtA, tgradAns + 1*3); --- 180,186 ---- - dtC*dtC*dtD - dtB*dtB*dtF - dtA*dtE*dtE); */ ! pvl->directAnswer[tenGageQ][0] = cbA*cbA - 3*cbB; } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQGradVec)) { ELL_3V_SET(QgradAns, 0, 0, 0); ELL_3V_SCALE_INCR(QgradAns, dtA, tgradAns + 1*3); *************** *** 266,282 **** ELL_3V_SCALE_INCR(QgradAns, tmptmp, tgradAns + 6*3); } ! if (1 & (query >> tenGageQGradMag)) { ! tmptmp = ans[offset[tenGageQGradMag]] = ELL_3V_LEN(QgradAns); } ! if (1 & (query >> tenGageQNormal)) { ! ELL_3V_SCALE(ans + offset[tenGageQNormal], 1.0/tmptmp, QgradAns); } ! if (1 & (query >> tenGageAniso)) { #if GAGE_TYPE_FLOAT ! tenAnisoCalc(ans + offset[tenGageAniso], evalAns); #else tenAnisoCalc(aniso, evalAnsF); for (ci=0; ci<=TEN_ANISO_MAX; ci++) { ! (ans + offset[tenGageAniso])[ci] = aniso[ci]; } #endif --- 195,211 ---- ELL_3V_SCALE_INCR(QgradAns, tmptmp, tgradAns + 6*3); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQGradMag)) { ! tmptmp = pvl->directAnswer[tenGageQGradMag][0] = ELL_3V_LEN(QgradAns); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageQNormal)) { ! ELL_3V_SCALE(pvl->directAnswer[tenGageQNormal], 1.0/tmptmp, QgradAns); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, tenGageAniso)) { #if GAGE_TYPE_FLOAT ! tenAnisoCalc(pvl->directAnswer[tenGageAniso], evalAns); #else tenAnisoCalc(aniso, evalAnsF); for (ci=0; ci<=TEN_ANISO_MAX; ci++) { ! pvl->directAnswer[tenGageAniso][ci] = aniso[ci]; } #endif *************** *** 291,300 **** 1, 7, ! TEN_GAGE_MAX, ! tenGageAnsLength, ! tenGageAnsOffset, ! TEN_GAGE_TOTAL_ANS_LENGTH, ! _tenGageNeedDeriv, ! _tenGagePrereq, _tenGageIv3Print, _tenGageFilter, --- 220,225 ---- 1, 7, ! TEN_GAGE_ITEM_MAX, ! _tenGageTable, _tenGageIv3Print, _tenGageFilter, Index: tendGlyph.c =================================================================== RCS file: /cvsroot/teem/teem/src/ten/tendGlyph.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tendGlyph.c 7 Jan 2004 15:34:31 -0000 1.22 --- tendGlyph.c 13 Feb 2004 23:00:09 -0000 1.23 *************** *** 45,50 **** char *outS; limnCamera *cam; ! limnObj *glyph; ! limnWin *win; echoScene *scene; echoRTParm *eparm; --- 45,50 ---- char *outS; limnCamera *cam; ! limnObject *glyph; ! limnWindow *win; echoScene *scene; echoRTParm *eparm; *************** *** 61,70 **** cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); ! glyph = limnObjNew(512, AIR_TRUE); ! airMopAdd(mop, glyph, (airMopper)limnObjNix, airMopAlways); scene = echoSceneNew(); airMopAdd(mop, scene, (airMopper)echoSceneNix, airMopAlways); ! win = limnWinNew(limnDevicePS); ! airMopAdd(mop, win, (airMopper)limnWinNix, airMopAlways); gparm = tenGlyphParmNew(); airMopAdd(mop, gparm, (airMopper)tenGlyphParmNix, airMopAlways); --- 61,70 ---- cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); ! glyph = limnObjectNew(512, AIR_TRUE); ! airMopAdd(mop, glyph, (airMopper)limnObjectNix, airMopAlways); scene = echoSceneNew(); airMopAdd(mop, scene, (airMopper)echoSceneNix, airMopAlways); ! win = limnWindowNew(limnDevicePS); ! airMopAdd(mop, win, (airMopper)limnWindowNix, airMopAlways); gparm = tenGlyphParmNew(); airMopAdd(mop, gparm, (airMopper)tenGlyphParmNix, airMopAlways); *************** *** 185,189 **** "resolution of polygonalization of glyphs (all glyphs " "other than the default box)"); ! hestOptAdd(&hopt, "wd", "3 widths", airTypeFloat, 3, 3, gparm->edgeWidth + 2, "0.8 0.4 0.0", "(* postscript only *) " "width of edges drawn for three kinds of glyph " --- 185,189 ---- "resolution of polygonalization of glyphs (all glyphs " "other than the default box)"); ! hestOptAdd(&hopt, "wd", "3 widths", airTypeFloat, 3, 3, gparm->edgeWidth, "0.8 0.4 0.0", "(* postscript only *) " "width of edges drawn for three kinds of glyph " *************** *** 276,288 **** cam->faar = 0.0000000001; cam->atRelative = AIR_TRUE; ! win->ps.edgeWidth[0] = gparm->edgeWidth[0]; ! win->ps.edgeWidth[1] = gparm->edgeWidth[1]; ! win->ps.edgeWidth[2] = gparm->edgeWidth[2]; ! win->ps.edgeWidth[3] = gparm->edgeWidth[3]; ! win->ps.edgeWidth[4] = gparm->edgeWidth[4]; win->ps.creaseAngle = 70; ELL_3V_COPY(win->ps.bg, bg); ! if (limnObjRender(glyph, cam, win) ! || limnObjPSDraw(glyph, cam, emap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble drawing glyphs:\n%s\n", me, err); --- 276,288 ---- cam->faar = 0.0000000001; cam->atRelative = AIR_TRUE; ! win->ps.lineWidth[limnEdgeTypeBackFacet] = 0; ! win->ps.lineWidth[limnEdgeTypeBackCrease] = 0; ! win->ps.lineWidth[limnEdgeTypeContour] = gparm->edgeWidth[0]; ! win->ps.lineWidth[limnEdgeTypeFrontCrease] = gparm->edgeWidth[1]; ! win->ps.lineWidth[limnEdgeTypeFrontFacet] = gparm->edgeWidth[2]; win->ps.creaseAngle = 70; ELL_3V_COPY(win->ps.bg, bg); ! if (limnObjectRender(glyph, cam, win) ! || limnObjectPSDraw(glyph, cam, emap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble drawing glyphs:\n%s\n", me, err); |
Update of /cvsroot/teem/teem/src/mite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29720 Modified Files: GNUmakefile defaultsMite.c mite.h privateMite.h ray.c renderMite.c thread.c txf.c user.c Log Message: in the midst of massive re-organizaztion; ignore Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/mite/GNUmakefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GNUmakefile 7 Jan 2004 15:34:30 -0000 1.14 --- GNUmakefile 13 Feb 2004 22:58:40 -0000 1.15 *************** *** 44,51 **** #### (ell for macros) #### ! $(L).NEED = hoover limn gage ell nrrd biff air $(L).PUBLIC_HEADERS = mite.h $(L).PRIVATE_HEADERS = privateMite.h ! $(L).OBJS = defaultsMite.o user.o txf.o renderMite.o thread.o ray.o #### #### --- 44,51 ---- #### (ell for macros) #### ! $(L).NEED = ten hoover limn gage ell nrrd biff air $(L).PUBLIC_HEADERS = mite.h $(L).PRIVATE_HEADERS = privateMite.h ! $(L).OBJS = defaultsMite.o kindnot.o renderMite.o thread.o ray.o txf.o user.o #### #### Index: defaultsMite.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/defaultsMite.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** defaultsMite.c 7 Jan 2004 15:34:30 -0000 1.6 --- defaultsMite.c 13 Feb 2004 22:58:40 -0000 1.7 *************** *** 34,36 **** double ! miteDefNear1 = 0.99; --- 34,39 ---- double ! miteDefOpacNear1 = 0.98; ! ! double ! miteDefOpacMatters = 0.05; Index: mite.h =================================================================== RCS file: /cvsroot/teem/teem/src/mite/mite.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mite.h 7 Jan 2004 15:34:30 -0000 1.24 --- mite.h 13 Feb 2004 22:58:40 -0000 1.25 *************** *** 28,31 **** --- 28,32 ---- #include <teem/limn.h> #include <teem/hoover.h> + #include <teem/ten.h> #if defined(_WIN32) && !defined(TEEM_STATIC) && !defined(__CYGWIN__) *************** *** 43,60 **** /* ******** mite_t ! ** */ ! ! /* typedef float mite_t; #define mite_nt nrrdTypeFloat #define mite_at airTypeFloat ! */ ! typedef double mite_t; #define mite_nt nrrdTypeDouble #define mite_at airTypeDouble ! enum { --- 44,67 ---- /* ******** mite_t ! ** ! ** the type used for representing and storing transfer function *range* ! ** (color, opacity, etc) information is: ! ** 1: float ! ** 0: double */ ! #if 0 typedef float mite_t; #define mite_nt nrrdTypeFloat #define mite_at airTypeFloat ! #define limnVTOQN limnVtoQN_f ! #define MITE_T_DOUBLE 0 ! #else typedef double mite_t; #define mite_nt nrrdTypeDouble #define mite_at airTypeDouble ! #define limnVTOQN limnVtoQN_d ! #define MITE_T_DOUBLE 1 ! #endif enum { *************** *** 98,112 **** ** unlike gage, there is no API for setting these- you go in the ** struct and set them yourself. */ typedef struct { ! Nrrd *nin, /* volume being rendered */ **ntxf, /* array of nrrds containing transfer functions, these are never altered (in contrast to ntxf in miteRender) */ ! *nout; /* output image container: we'll nrrdMaybeAlloc all ! the image data and put it in here, but we won't ! nrrdNuke(nout), just like we won't nrrdNuke ! nin or any of the ntxf[i] */ int ntxfNum; /* allocated and valid length of ntxf[] */ /* for each possible element of the txf range, what value should it start at prior to multiplying by the values (if any) learned from --- 105,129 ---- ** unlike gage, there is no API for setting these- you go in the ** struct and set them yourself. + ** + ** Mite can currently handle scalar, 3-vector, and (symmetric) tensor + ** volumes, one (at most) of each. All these volumes must have the + ** same 3-D size, because we're only using one gageContext per thread, + ** and the gageContext is what stores the convolution kernel weights + ** evaluated per sample. */ typedef struct { ! Nrrd *nsin, /* scalar volume being rendered */ ! *nvin, /* 3-vector volume being rendered */ ! *ntin, /* tensor volume being rendered */ **ntxf, /* array of nrrds containing transfer functions, these are never altered (in contrast to ntxf in miteRender) */ ! *nout; /* output image container, for five-channel output ! RGBAZ. We'll nrrdMaybeAlloc all the image data ! and put it in here, but we won't nrrdNuke(nout), ! just like we won't nrrdNuke nsin, ntin, or any of ! the ntxf[i] */ int ntxfNum; /* allocated and valid length of ntxf[] */ + char shadeStr[AIR_STRLEN_MED]; /* how to do shading */ /* for each possible element of the txf range, what value should it start at prior to multiplying by the values (if any) learned from *************** *** 116,121 **** double refStep, /* length of "unity" for doing opacity correction */ rayStep, /* distance between sampling planes */ ! near1; /* close enough to unity for the sake of doing early ! ray termination when opacity gets high */ hooverContext *hctx; /* context and input for all hoover-related things, including camera and image parameters */ --- 133,141 ---- double refStep, /* length of "unity" for doing opacity correction */ rayStep, /* distance between sampling planes */ ! opacMatters, /* minimal significant opacity, currently used to ! assign a Z depth (really "Tw") for each rendered ! ray */ ! opacNear1; /* opacity close enough to unity for the sake of ! doing early ray termination */ hooverContext *hctx; /* context and input for all hoover-related things, including camera and image parameters */ *************** *** 125,129 **** including all kernels. This is gageContextCopy'd for multi-threaded use (hence the 0) */ ! limnLight *lit; /* a struct for all lighting info */ int normalSide, /* determines direction of gradient that is used as normal for shading: --- 145,151 ---- including all kernels. This is gageContextCopy'd for multi-threaded use (hence the 0) */ ! limnLight *lit; /* a struct for all lighting info, although ! currently only the ambient and *first* directional ! light are used */ int normalSide, /* determines direction of gradient that is used as normal for shading: *************** *** 133,139 **** -1: normal points to higher values (lower values more "inside") */ ! justSum, /* don't use opacity: just sum colors */ ! noDirLight; /* forget directional phong lighting, using only ! the ambient component */ airArray *umop; /* for things allocated which are used across multiple renderings */ --- 155,159 ---- -1: normal points to higher values (lower values more "inside") */ ! verbUi, verbVi; /* pixel coordinate for which to turn on verbosity */ airArray *umop; /* for things allocated which are used across multiple renderings */ *************** *** 146,160 **** /* ******** miteRender ** ! ** rendering-parameter-set-specific, but non-thread-specific, ! ** state relevant for mite's internal use */ typedef struct { ! Nrrd **ntxf; /* array of transfer function nrrds. The only difference from those in miteUser is that ! opacity correction has been applied to ! these */ int ntxfNum; /* allocated and valid length of ntxf[] */ double time0; /* rendering start time */ --- 166,217 ---- /* + ******** miteShadeMethod* enum + ** + ** the different ways that shading can be done + */ + enum { + miteShadeMethodUnknown, + miteShadeMethodNone, /* 1: no direction shading based on anything + in the miteShadeSpec: just ambient + (though still using over operator) */ + miteShadeMethodPhong, /* 2: what mite has been doing all along */ + miteShadeMethodLitTen, /* 3: (tensor-based) lit-tensors */ + miteShadeMethodLast + }; + + /* + ******** miteShadeSpec struct + ** + ** describes how to do shading. With more and more generality in the + ** expressions that are evaluated for transfer function application, + ** there is less need for this "shading" per se (phong shading can be + ** expressed with multiplicative and additive transfer functions). + ** But its here for the time being... + */ + typedef struct { + int shadeMethod; /* from miteShadeMethod* enum */ + gageQuerySpec *vec0, *vec1, + *scl0, *scl1; /* things to use for shading. How these are + interpreted is determined by shadeMethod: + phong: vec0 is used as normal + litten: lit-tensors based on vec0 and vec1, + as weighted by scl0, scl1 */ + } miteShadeSpec; + + /* ******** miteRender ** ! ** rendering-parameter-set-specific (but non-thread-specific) state, ! ** used internally by mite */ typedef struct { ! Nrrd **ntxf; /* array of transfer function nrrds. The difference from those in miteUser is that ! opacity correction (based on rayStep and ! refStep) has been applied to these, and ! these have been converted/unquantized to ! type mite_t */ int ntxfNum; /* allocated and valid length of ntxf[] */ + miteShadeSpec *shpec; /* information based on muu->shadeStr */ double time0; /* rendering start time */ *************** *** 168,174 **** } miteRender; typedef struct { ! gage_t *val; /* the gage-measured txf axis variable */ ! int size; /* number of entries */ double min, max; /* min, max (copied from nrrd axis) */ mite_t *data; /* pointer to txf data. If non-NULL, the --- 225,256 ---- } miteRender; + /* + ******** miteStageOp* enum + ** + ** the kinds of things we can do per txf to modify the range variables. + ** previously mite only supported seperable transfer functions (i.e., + ** multiplication only) + */ + enum { + miteStageOpUnknown, + miteStageOpAdd, + miteStageOpMax, + miteStageOpMultiply, + miteStageOpLast + }; + typedef struct { ! gage_t *val; /* the txf axis variable, computed either by ! gage or by mite. This points into the ! answer vector in one of the thread's ! pervolumes */ ! int size, /* number of entries along this txf axis */ ! op, /* from miteStageOp* enum. Note that this ! operation applies to ALL the range variables ! adjusted by this txf (can't add color while ! multiplying opacity) */ ! (*qn)(gage_t *); /* callback for doing vector quantization of ! vector-valued txf domain variables, or ! NULL if this is a scalar variable */ double min, max; /* min, max (copied from nrrd axis) */ mite_t *data; /* pointer to txf data. If non-NULL, the *************** *** 180,208 **** /* ! ******** miteScl* enum ** ! ** the quantities not measured by gage which can appear in the ! ** transfer function domain. All of these are cheap to compute, ! ** so all of them are saved/computed per sample, and stored in ! ** the miteThread */ enum { ! miteSclUnknown=-1, /* -1: nobody knows */ ! miteSclXw, /* 0: "Xw", X position, world space */ ! miteSclXi, /* 1: "Xi", X " , index " */ ! miteSclYw, /* 2: "Yw", Y " , world " */ ! miteSclYi, /* 3: "Yi", Y " , index " */ ! miteSclZw, /* 4: "Zw", Z " , world " */ ! miteSclZi, /* 5: "Zi", Z " , index " */ ! miteSclTw, /* 6: "Tw", ray position */ ! miteSclTi, /* 7: "Ti", ray index (ray sample #) */ ! miteSclNdotV, /* 8: "NdotV", surface normal dotted w/ view vector ! (towards eye) */ ! miteSclNdotL, /* 9: "NdotL", surface normal dotted w/ light vector ! (towards the light source) */ ! miteSclGTdotV, /* 10: "GTdotV", normal curvature in view direction */ ! miteSclLast }; ! #define MITE_SCL_MAX 10 /* --- 262,301 ---- /* ! ******** miteVal* enum ** ! ** the quantities not measured by gage (but often reliant on gage-based ! ** measurements) which can appear in the transfer function domain. ! ** In many respects, these behave like gage queries, and these are ! ** associated with a gageKind (miteValGageKind), but it is hardly a ! ** real, bona fide, gageKind. The answers for these are stored in ! ** the miteThread, in lieu of a gagePerVolume */ enum { ! miteValUnknown=-1, /* -1: nobody knows */ ! miteValXw, /* 0: "Xw", X position, world space (*gage_t) */ ! miteValXi, /* 1: "Xi", X " , index " (*gage_t) */ ! miteValYw, /* 2: "Yw", Y " , world " (*gage_t) */ ! miteValYi, /* 3: "Yi", Y " , index " (*gage_t) */ ! miteValZw, /* 4: "Zw", Z " , world " (*gage_t) */ ! miteValZi, /* 5: "Zi", Z " , index " (*gage_t) */ ! miteValTw, /* 6: "Tw", ray position (*gage_t) */ ! miteValTi, /* 7: "Ti", ray index (ray sample #) (*gage_t) */ ! miteValNdotV, /* 8: "NdotV", surface normal dotted w/ view vector ! (towards eye) (*gage_t) */ ! miteValNdotL, /* 9: "NdotL", surface normal dotted w/ light vector ! (towards the light source) (*gage_t) */ ! miteValGTdotV, /* 10: "GTdotV", normal curvature in view direction ! (*gage_t) */ ! miteValVrefN, /* 11: "VrefN", view vector (towards eye) reflected ! across surface normal (gage_t[3]) */ ! miteValVdefT, /* 12: "VdefT", view direction, deflected by tensor, ! then normalized (gage_t[3]) */ ! miteValVdefTdotV, /* 13: "VdefTdotV", VdefT dotted back with V, not the ! same as the tensor contraction along V, ! (*gage_t) */ ! miteValLast }; ! #define MITE_VAL_MAX 13 ! #define MITE_VAL_TOTAL_ANS_LENGTH 18 /* *************** *** 213,226 **** typedef struct miteThread_t { gageContext *gctx; /* per-thread context */ ! gage_t *ans, /* shortcut to gctx->pvl[0]->ans */ ! *norm, /* shortcut to ans[gageSclNormal] */ ! *nPerp, /* shortcut to ans[gageSclNPerp] */ ! *gten, /* shortcut to ans[gageSclGeomTens] */ ! mscl[MITE_SCL_MAX+1]; /* all the miteScl */ int verbose, /* blah blah blah */ thrid, /* thread ID */ ui, vi, /* image coords */ ! samples; /* number of samples handled so far ! by this thread */ miteStage *stage; /* array of stages for txf computation */ int stageNum; /* number of stages == length of stage[] */ --- 306,320 ---- typedef struct miteThread_t { gageContext *gctx; /* per-thread context */ ! gage_t *ansScl, /* shortcut to scalar answer vector */ ! *ansVec, /* shortcut to vector answer vector */ ! *ansTen, /* shortcut to tensor answer vector */ ! *vec0, *vec1, *scl0, *scl1, /* shortcuts vectors/scalars used for ! shading; explained with miteShadeSpec */ ! ansMiteVal[MITE_VAL_TOTAL_ANS_LENGTH]; /* room for all the miteVal */ int verbose, /* blah blah blah */ thrid, /* thread ID */ ui, vi, /* image coords */ ! samples; /* number of samples handled so far by ! this thread */ miteStage *stage; /* array of stages for txf computation */ int stageNum; /* number of stages == length of stage[] */ *************** *** 228,233 **** copied from miteUser's rangeInit[], or over-written by txf evaluation */ ! rayStep, /* per-ray step, to implement sampling ! on planes */ V[3], /* per-ray view direction */ RR, GG, BB, TT; /* per-ray composited values */ --- 322,327 ---- copied from miteUser's rangeInit[], or over-written by txf evaluation */ ! rayStep, /* per-ray step (may need to be different for ! each ray to enable sampling on planes) */ V[3], /* per-ray view direction */ RR, GG, BB, TT; /* per-ray composited values */ *************** *** 239,248 **** extern mite_export int miteDefRenorm; extern mite_export int miteDefNormalSide; ! extern mite_export double miteDefNear1; /* txf.c */ - extern mite_export airEnum *miteScl; extern mite_export char miteRangeChar[MITE_RANGE_NUM]; ! extern int miteNtxfCheck(Nrrd *ntxf, gageKind *kind); /* user.c */ --- 333,348 ---- extern mite_export int miteDefRenorm; extern mite_export int miteDefNormalSide; ! extern mite_export double miteDefOpacNear1; ! extern mite_export double miteDefOpacMatters; ! ! /* kindnot.c */ ! extern mite_export airEnum *miteVal; ! extern mite_export gageKind *miteValGageKind; /* txf.c */ extern mite_export char miteRangeChar[MITE_RANGE_NUM]; ! extern void miteVariablePrint(char *buff, const gageQuerySpec *qsp); ! extern int miteVariableParse(gageQuerySpec *qsp, const char *label); ! extern int miteNtxfCheck(const Nrrd *ntxf); /* user.c */ *************** *** 251,254 **** --- 351,357 ---- /* renderMite.c */ + extern miteShadeSpec *miteShadeSpecNew(); + extern miteShadeSpec *miteShadeSpecNix(miteShadeSpec *); + extern int miteShadeParse(miteShadeSpec *shpec, char *shadeStr); extern int miteRenderBegin(miteRender **mrrP, miteUser *muu); extern int miteRenderEnd(miteRender *mrr, miteUser *muu); Index: privateMite.h =================================================================== RCS file: /cvsroot/teem/teem/src/mite/privateMite.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** privateMite.h 7 Jan 2004 15:34:30 -0000 1.3 --- privateMite.h 13 Feb 2004 22:58:40 -0000 1.4 *************** *** 25,33 **** #endif /* txf.c */ ! extern int _miteDomainParse(char *label, gageKind *kind); ! extern unsigned int _miteNtxfQuery(Nrrd *ntxf, gageKind *kind); extern int _miteNtxfAlphaAdjust(miteRender *mrr, miteUser *muu); ! extern int _miteStageSet(miteThread *mtt, miteRender *mrr, gageKind *kind); extern void _miteStageRun(miteThread *mtt); --- 25,40 ---- #endif + #if GAGE_TYPE_FLOAT + #define limnVtoQN_GT limnVtoQN_f + #else + #define limnVtoQN_GT limnVtoQN_d + #endif + /* txf.c */ ! extern void _miteQuery(unsigned int *queryScl, ! unsigned int *queryVec, ! unsigned int *queryTen, gageQuerySpec *qsp); extern int _miteNtxfAlphaAdjust(miteRender *mrr, miteUser *muu); ! extern int _miteStageSet(miteThread *mtt, miteRender *mrr); extern void _miteStageRun(miteThread *mtt); Index: ray.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/ray.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ray.c 7 Jan 2004 15:34:30 -0000 1.16 --- ray.c 13 Feb 2004 22:58:40 -0000 1.17 *************** *** 36,40 **** fflush(stderr); } ! mtt->verbose = 0*(uIndex == 35 && vIndex == 42); mtt->RR = mtt->GG = mtt->BB = 0.0; mtt->TT = 1.0; --- 36,40 ---- fflush(stderr); } ! mtt->verbose = (uIndex == muu->verbUi && vIndex == muu->verbVi); mtt->RR = mtt->GG = mtt->BB = 0.0; mtt->TT = 1.0; *************** *** 62,93 **** ks = mtt->range[miteRangeKs]; ELL_3V_SCALE(ad, ka, muu->lit->amb); ! if (!muu->noDirLight && (kd || ks)) { ! if (muu->normalSide) { ! ELL_3V_SCALE(N, -muu->normalSide, mtt->norm); ! } else { ! ELL_3V_COPY(N, mtt->norm); ! } ! if (kd) { ! LdotN = ELL_3V_DOT(muu->lit->dir[0], N); ! if (!muu->normalSide) { ! LdotN = AIR_ABS(LdotN); ! } ! if (LdotN > 0) { ! ELL_3V_SCALE_ADD2(ad, 1.0, ad, LdotN*kd, muu->lit->col[0]); } ! } ! if (ks) { ! sp = mtt->range[miteRangeSP]; ! ELL_3V_ADD2(H, muu->lit->dir[0], mtt->V); ! ELL_3V_NORM(H, H, tmp); ! HdotN = ELL_3V_DOT(H, N); ! if (!muu->normalSide) { ! HdotN = AIR_ABS(HdotN); } ! if (HdotN > 0) { ! HdotN = pow(HdotN, sp); ! ELL_3V_SCALE(s, HdotN*ks, muu->lit->col[0]); } } } *R = (E - 1 + ad[0])*col[0] + s[0]; --- 62,101 ---- ks = mtt->range[miteRangeKs]; ELL_3V_SCALE(ad, ka, muu->lit->amb); ! if (miteShadeMethodPhong == mrr->shpec->shadeMethod) { ! if (kd || ks) { ! if (muu->normalSide) { ! ELL_3V_SCALE(N, -muu->normalSide, mtt->vec0); ! } else { ! ELL_3V_COPY(N, mtt->vec0); } ! if (kd) { ! LdotN = ELL_3V_DOT(muu->lit->dir[0], N); ! if (!muu->normalSide) { ! LdotN = AIR_ABS(LdotN); ! } ! if (LdotN > 0) { ! ELL_3V_SCALE_ADD2(ad, 1.0, ad, LdotN*kd, muu->lit->col[0]); ! } } ! if (ks) { ! sp = mtt->range[miteRangeSP]; ! ELL_3V_ADD2(H, muu->lit->dir[0], mtt->V); ! ELL_3V_NORM(H, H, tmp); ! HdotN = ELL_3V_DOT(H, N); ! if (!muu->normalSide) { ! HdotN = AIR_ABS(HdotN); ! } ! if (HdotN > 0) { ! HdotN = pow(HdotN, sp); ! ELL_3V_SCALE(s, HdotN*ks, muu->lit->col[0]); ! } } } + } else if (miteShadeMethodLitTen == mrr->shpec->shadeMethod) { + + } else { + fprintf(stderr, "!%s: PANIC, shadeMethod %d unimplemented\n", + me, mrr->shpec->shadeMethod); + exit(1); } *R = (E - 1 + ad[0])*col[0] + s[0]; *************** *** 121,125 **** } ! if (1-mtt->TT >= muu->near1 && !muu->justSum) { /* early ray termination */ mtt->TT = 0.0; --- 129,133 ---- } ! if (1-mtt->TT >= muu->opacNear1) { /* early ray termination */ mtt->TT = 0.0; *************** *** 132,155 **** biffAdd(MITE, err); return AIR_NAN; } ! /* HEY: NONE of this should be done if the txfs don't need any miteScl */ ! mtt->mscl[miteSclXw] = samplePosWorld[0]; ! mtt->mscl[miteSclXi] = samplePosIndex[0]; ! mtt->mscl[miteSclYw] = samplePosWorld[1]; ! mtt->mscl[miteSclYi] = samplePosIndex[1]; ! mtt->mscl[miteSclZw] = samplePosWorld[2]; ! mtt->mscl[miteSclZi] = samplePosIndex[2]; ! mtt->mscl[miteSclTw] = rayT; ! mtt->mscl[miteSclTi] = num; ! mtt->mscl[miteSclNdotV] = -muu->normalSide*ELL_3V_DOT(mtt->V, mtt->norm); ! mtt->mscl[miteSclNdotL] = -muu->normalSide*ELL_3V_DOT(mtt->norm, ! muu->lit->dir[0]); if (!muu->normalSide) { ! mtt->mscl[miteSclNdotV] = AIR_ABS(mtt->mscl[miteSclNdotV]); ! mtt->mscl[miteSclNdotL] = AIR_ABS(mtt->mscl[miteSclNdotL]); } ELL_3MV_MUL(kn, mtt->nPerp, mtt->V); ELL_3V_NORM(kn, kn, len); ELL_3MV_MUL(knd, mtt->gten, kn); ! mtt->mscl[miteSclGTdotV] = ELL_3V_DOT(knd, kn); memcpy(mtt->range, muu->rangeInit, MITE_RANGE_NUM*sizeof(mite_t)); --- 140,163 ---- biffAdd(MITE, err); return AIR_NAN; } ! /* HEY: NONE of this should be done if the txfs don't need any miteVal */ ! mtt->ansMiteVal[miteValXw] = samplePosWorld[0]; ! mtt->ansMiteVal[miteValXi] = samplePosIndex[0]; ! mtt->ansMiteVal[miteValYw] = samplePosWorld[1]; ! mtt->ansMiteVal[miteValYi] = samplePosIndex[1]; ! mtt->ansMiteVal[miteValZw] = samplePosWorld[2]; ! mtt->ansMiteVal[miteValZi] = samplePosIndex[2]; ! mtt->ansMiteVal[miteValTw] = rayT; ! mtt->ansMiteVal[miteValTi] = num; ! mtt->ansMiteVal[miteValNdotV] = -muu->normalSide*ELL_3V_DOT(mtt->V, mtt->vec0); ! mtt->ansMiteVal[miteValNdotL] = -muu->normalSide*ELL_3V_DOT(mtt->vec0, ! muu->lit->dir[0]); if (!muu->normalSide) { ! mtt->ansMiteVal[miteValNdotV] = AIR_ABS(mtt->ansMiteVal[miteValNdotV]); ! mtt->ansMiteVal[miteValNdotL] = AIR_ABS(mtt->ansMiteVal[miteValNdotL]); } ELL_3MV_MUL(kn, mtt->nPerp, mtt->V); ELL_3V_NORM(kn, kn, len); ELL_3MV_MUL(knd, mtt->gten, kn); ! mtt->ansMiteVal[miteValGTdotV] = ELL_3V_DOT(knd, kn); memcpy(mtt->range, muu->rangeInit, MITE_RANGE_NUM*sizeof(mite_t)); *************** *** 162,176 **** } _miteRGBACalc(&R, &G, &B, &A, mtt, mrr, muu); ! if (muu->justSum) { ! mtt->RR += A*R; ! mtt->GG += A*G; ! mtt->BB += A*B; ! mtt->TT += A; ! } else { ! mtt->RR += mtt->TT*A*R; ! mtt->GG += mtt->TT*A*G; ! mtt->BB += mtt->TT*A*B; ! mtt->TT *= 1-A; ! } if (mtt->verbose) { fprintf(stderr, "%s: after compositing: RGBT = %g,%g,%g,%g\n", --- 170,177 ---- } _miteRGBACalc(&R, &G, &B, &A, mtt, mrr, muu); ! mtt->RR += mtt->TT*A*R; ! mtt->GG += mtt->TT*A*G; ! mtt->BB += mtt->TT*A*B; ! mtt->TT *= 1-A; if (mtt->verbose) { fprintf(stderr, "%s: after compositing: RGBT = %g,%g,%g,%g\n", Index: renderMite.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/renderMite.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** renderMite.c 7 Jan 2004 15:34:30 -0000 1.9 --- renderMite.c 13 Feb 2004 22:58:40 -0000 1.10 *************** *** 21,24 **** --- 21,56 ---- #include "privateMite.h" + miteShadeSpec * + miteShadeSpecNew(void) { + miteShadeSpec *shpec; + + shpec = (miteShadeSpec *)calloc(1, sizeof(miteShadeSpec)); + if (shpec) { + shpec->shadeMethod = miteShadeMethodUnknown; + shpec->vec0 = gageQuerySpecNew(); + shpec->vec1 = gageQuerySpecNew(); + shpec->scl0 = gageQuerySpecNew(); + shpec->scl1 = gageQuerySpecNew(); + if (!( shpec->vec0 && shpec->vec1 && + shpec->scl0 && shpec->scl1 )) { + return NULL; + } + } + return shpec; + } + + miteShadeSpec * + miteShadeSpecNix(miteShadeSpec *shpec) { + + if (shpec) { + shpec->vec0 = gageQuerySpecNix(shpec->vec0); + shpec->vec1 = gageQuerySpecNix(shpec->vec1); + shpec->scl0 = gageQuerySpecNix(shpec->scl0); + shpec->scl1 = gageQuerySpecNix(shpec->scl1); + AIR_FREE(shpec); + } + return NULL; + } + miteRender * _miteRenderNew(void) { *************** *** 30,34 **** --- 62,70 ---- if (!mrr->rmop) { AIR_FREE(mrr); + return mrr; } + mrr->shpec = miteShadeSpecNew(); + airMopAdd(mrr->rmop, mrr->shpec, + (airMopper)miteShadeSpecNix, airMopAlways); } return mrr; *************** *** 45,54 **** } int miteRenderBegin(miteRender **mrrP, miteUser *muu) { char me[]="miteRenderBegin", err[AIR_STRLEN_MED]; gagePerVolume *pvl; ! int E, T, thr; ! unsigned int query; if (!(mrrP && muu)) { --- 81,186 ---- } + int + miteShadeParse(miteShadeSpec *shpec, char *shadeStr) { + char me[]="miteShadeParse", err[AIR_STRLEN_MED], *buff, *qstr, *tok, *state; + airArray *mop; + int ansLength; + + mop = airMopNew(); + if (!( shpec && airStrlen(shadeStr) )) { + sprintf(err, "%s: got NULL pointer and/or empty string", me); + biffAdd(MITE, err); airMopError(mop); return 1; + } + buff = airToLower(airStrdup(shadeStr)); + if (!buff) { + sprintf(err, "%s: couldn't strdup shading spec", me); + biffAdd(MITE, err); airMopError(mop); return 1; + } + airMopAdd(mop, buff, airFree, airMopAlways); + if (!strcmp("none", buff)) { + shpec->shadeMethod = miteShadeMethodNone; + } else if (buff == strstr("phong:", buff)) { + qstr = buff + strlen("phong:"); + if (miteVariableParse(shpec->vec0, qstr)) { + sprintf(err, "%s: couldn't parse \"%s\" as shading vector", me, qstr); + biffAdd(MITE, err); airMopError(mop); return 1; + } + ansLength = shpec->vec0->kind->ansLength[shpec->vec0->query]; + if (3 != ansLength) { + sprintf(err, "%s: \"%s\" isn't a vector (answer length is %d, not 3)", + me, qstr, ansLength); + biffAdd(MITE, err); airMopError(mop); return 1; + } + fprintf(stderr, "!%s: got phong:%s(%s)\n", me, + shpec->vec0->kind->name, + airEnumStr(shpec->vec0->kind->enm, shpec->vec0->query)); + } else if (buff == strstr("litten:", buff)) { + qstr = buff + strlen("litten:"); + /* ---- first vector */ + tok = airStrtok(qstr, ",", &state); + if (miteVariableParse(shpec->vec0, tok)) { + sprintf(err, "%s: couldn't parse \"%s\" as lit-tensor vector", me, tok); + biffAdd(MITE, err); airMopError(mop); return 1; + } + ansLength = shpec->vec0->kind->ansLength[shpec->vec0->query]; + if (3 != ansLength) { + sprintf(err, "%s: \"%s\" isn't a vector (answer length is %d, not 3)", + me, qstr, ansLength); + biffAdd(MITE, err); airMopError(mop); return 1; + } + /* ---- second vector */ + tok = airStrtok(qstr, ",", &state); + if (miteVariableParse(shpec->vec1, tok)) { + sprintf(err, "%s: couldn't parse \"%s\" as lit-tensor vector", me, tok); + biffAdd(MITE, err); airMopError(mop); return 1; + } + ansLength = shpec->vec1->kind->ansLength[shpec->vec1->query]; + if (3 != ansLength) { + sprintf(err, "%s: \"%s\" isn't a vector (answer length is %d, not 3)", + me, qstr, ansLength); + biffAdd(MITE, err); airMopError(mop); return 1; + } + /* ---- first scalar */ + tok = airStrtok(qstr, ",", &state); + if (miteVariableParse(shpec->scl0, tok)) { + sprintf(err, "%s: couldn't parse \"%s\" as lit-tensor scalar", me, tok); + biffAdd(MITE, err); airMopError(mop); return 1; + } + ansLength = shpec->scl0->kind->ansLength[shpec->scl0->query]; + if (1 != ansLength) { + sprintf(err, "%s: \"%s\" isn't a scalar (answer length is %d, not 1)", + me, qstr, ansLength); + biffAdd(MITE, err); airMopError(mop); return 1; + } + /* ---- second scalar */ + tok = airStrtok(qstr, ",", &state); + if (miteVariableParse(shpec->scl1, tok)) { + sprintf(err, "%s: couldn't parse \"%s\" as lit-tensor scalar", me, tok); + biffAdd(MITE, err); airMopError(mop); return 1; + } + ansLength = shpec->scl1->kind->ansLength[shpec->scl1->query]; + if (1 != ansLength) { + sprintf(err, "%s: \"%s\" isn't a scalar (answer length is %d, not 1)", + me, qstr, ansLength); + biffAdd(MITE, err); airMopError(mop); return 1; + } + fprintf(stderr, "!%s: got litten:%s(%s),\n", me, + shpec->vec0->kind->name, + airEnumStr(shpec->vec0->kind->enm, shpec->vec0->query)); + } else { + sprintf(err, "%s: shading specification \"%s\" not understood", + me, shadeStr); + biffAdd(MITE, err); airMopError(mop); return 1; + } + airMopOkay(mop); + return 0; + } + int miteRenderBegin(miteRender **mrrP, miteUser *muu) { char me[]="miteRenderBegin", err[AIR_STRLEN_MED]; gagePerVolume *pvl; ! int E, T, thr, axi; ! unsigned int queryScl, queryVec, queryTen; if (!(mrrP && muu)) { *************** *** 69,84 **** } ! query = 0; for (T=0; T<muu->ntxfNum; T++) { ! query |= _miteNtxfQuery(muu->ntxf[T], gageKindScl); } if (!muu->noDirLight) { query |= 1<<gageSclNormal; } fprintf(stderr, "!%s: gageScl query: \n", me); gageQueryPrint(stderr, gageKindScl, query); E = 0; ! if (!E) E |= !(pvl = gagePerVolumeNew(muu->gctx0, muu->nin, gageKindScl)); if (!E) E |= gagePerVolumeAttach(muu->gctx0, pvl); if (!E) E |= gageKernelSet(muu->gctx0, gageKernel00, --- 201,225 ---- } ! queryScl = 0; ! queryTen = 0; for (T=0; T<muu->ntxfNum; T++) { ! for (axi=1; axi<=muu->ntxf[T]->dim-1; axi++) { ! _miteNtxfQuery(&queryScl, &queryVec, &queryTen, ! muu->ntxf[T]->axis[axi]->label); } if (!muu->noDirLight) { query |= 1<<gageSclNormal; } + /* fprintf(stderr, "!%s: gageScl query: \n", me); gageQueryPrint(stderr, gageKindScl, query); + */ E = 0; ! if (!muu->nsin) { ! sprintf(err, "%s: sorry- can't proceed without scalar volume", me); ! biffAdd(MITE, err); return 1; ! } ! if (!E) E |= !(pvl = gagePerVolumeNew(muu->gctx0, muu->nsin, gageKindScl)); if (!E) E |= gagePerVolumeAttach(muu->gctx0, pvl); if (!E) E |= gageKernelSet(muu->gctx0, gageKernel00, Index: thread.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/thread.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** thread.c 7 Jan 2004 15:34:30 -0000 1.8 --- thread.c 13 Feb 2004 22:58:40 -0000 1.9 *************** *** 44,48 **** } } ! (*mttP)->ans = (*mttP)->gctx->pvl[0]->ans; (*mttP)->norm = (*mttP)->ans + gageKindScl->ansOffset[gageSclNormal]; (*mttP)->nPerp = (*mttP)->ans + gageKindScl->ansOffset[gageSclNPerp]; --- 44,48 ---- } } ! (*mttP)->ansScl = (*mttP)->gctx->pvl[0]->ans; (*mttP)->norm = (*mttP)->ans + gageKindScl->ansOffset[gageSclNormal]; (*mttP)->nPerp = (*mttP)->ans + gageKindScl->ansOffset[gageSclNPerp]; Index: txf.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/txf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** txf.c 7 Jan 2004 15:34:30 -0000 1.12 --- txf.c 13 Feb 2004 22:58:41 -0000 1.13 *************** *** 29,163 **** miteRangeChar[MITE_RANGE_NUM] = "ARGBEadsp"; ! char ! _miteSclStr[][AIR_STRLEN_SMALL] = { ! "(unknown miteScl)", ! "Xw", ! "Xi", ! "Yw", ! "Yi", ! "Zw", ! "Zi", ! "Tw", ! "Ti", ! "NdotV", ! "NdotL", ! "GTdotV" ! }; ! ! int ! _miteSclVal[] = { ! miteSclUnknown, ! miteSclXw, ! miteSclXi, ! miteSclYw, ! miteSclYi, ! miteSclZw, ! miteSclZi, ! miteSclTw, ! miteSclTi, ! miteSclNdotV, ! miteSclNdotL, ! miteSclGTdotV, ! }; ! ! char ! _miteSclStrEqv[][AIR_STRLEN_SMALL] = { ! "x", "xw", ! "xi", ! "y", "yw", ! "yi", ! "z", "zw", ! "zi", ! "t", "tw", ! "ti", ! "ndotv", ! "ndotl", ! "gtdotv", ! "" ! }; ! ! int ! _miteSclValEqv[] = { ! miteSclXw, miteSclXw, ! miteSclXi, ! miteSclYw, miteSclYw, ! miteSclYi, ! miteSclZw, miteSclZw, ! miteSclZi, ! miteSclTw, miteSclTw, ! miteSclTi, ! miteSclNdotV, ! miteSclNdotL, ! miteSclGTdotV ! }; - airEnum - _miteScl = { - "miteScl", - MITE_SCL_MAX+1, - _miteSclStr, _miteSclVal, - NULL, - _miteSclStrEqv, _miteSclValEqv, - AIR_FALSE - }; - airEnum * - miteScl = &_miteScl; int ! _miteDomainParse(char *label, gageKind *kind) { ! char me[]="_miteDomainParse", err[AIR_STRLEN_MED], *buff, *paren, *qstr; ! int domI; ! ! if (!label) { sprintf(err, "%s: got NULL pointer", me); ! biffAdd(MITE, err); return -1; } ! if (label == strstr(label, "gage(")) { /* txf domain variable is to be measured directly by gage */ ! buff = airStrdup(label); ! if (!buff) { ! sprintf(err, "%s: this is so annoying", me); ! biffAdd(MITE, err); return -1; ! } ! if (!(paren = strstr(buff, ")"))) { sprintf(err, "%s: didn't see close paren after \"gage(\"", me); ! biffAdd(MITE, err); return -1; } ! *paren = 0; ! qstr = buff + strlen("gage("); ! domI = airEnumVal(gageScl, qstr); ! if (gageSclUnknown == domI) { ! sprintf(err, "%s: couldn't parse \"%s\" as a gageScl varable", me, qstr); ! biffAdd(MITE, err); free(buff); return -1; } ! if (1 != kind->ansLength[domI]) { ! sprintf(err, "%s: %s isn't a scalar, so it can't a txf domain variable", ! me, airEnumStr(gageScl, domI)); ! biffAdd(MITE, err); free(buff); return -1; } ! free(buff); } else { ! /* txf domain variable is not directly measured by gage */ ! domI = airEnumVal(miteScl, label); ! if (miteSclUnknown == domI) { ! sprintf(err, "%s: couldn't parse \"%s\" as a miteScl variable", ! me, label); ! biffAdd(MITE, err); return -1; } - /* this signifies that its a miteScl, not a gageScl */ - domI += GAGE_SCL_MAX+1; } ! return domI; } int ! miteNtxfCheck(Nrrd *ntxf, gageKind *kind) { char me[]="miteNtxfCheck", err[AIR_STRLEN_MED], *range, *domS; ! int i; - if (!( ntxf && kind )) { - sprintf(err, "%s: got NULL pointer", me); - biffAdd(MITE, err); return 1; - } if (nrrdCheck(ntxf)) { sprintf(err, "%s: basic nrrd validity check failed", me); --- 29,169 ---- miteRangeChar[MITE_RANGE_NUM] = "ARGBEadsp"; ! void ! miteVariablePrint(char *buff, const gageQuerySpec *qsp) { ! char me[]="miteVariablePrint"; ! ! if (gageKindScl == qsp->kind ! || gageKindVec == qsp->kind ! || tenGageKind == qsp->kind) { ! sprintf(buff, "gage(%s:%s)", qsp->kind->name, ! airEnumStr(qsp->kind->enm, qsp->query)); ! } else if (miteValGageKind == qsp->kind) { ! sprintf(buff, "%s(%s)", qsp->kind->name, ! airEnumStr(qsp->kind->enm, qsp->query)); ! } else { ! sprintf(buff, "(%s: unknown variable!)", me); ! } ! return; ! } + /* + ******** miteVariableParse() + ** + ** takes a string (usually the label from a nrrd axis) and parses it + ** to determine the gageQuerySpec from it (which means finding the + ** kind and query). The valid formats are (currently): + ** + ** <query> : miteValGageKind (DEPRECATED) + ** gage(<query>) : gageKindScl (DEPRECATED) + ** gage(scalar:<query>) : gageKindScl (preferred) + ** gage(vector:<query>) : gageKindVec + ** gage(tensor:<query>) : tenGageKind + ** mite(<query>) : miteValGageKind + ** + ** Notice that "scalar", "vector", and "tensor" to NOT refer to the type + ** of the quantity being measured, but rather to the type of volume in + ** which quantity is measured (i.e., the gageKind used) + */ int ! miteVariableParse(gageQuerySpec *qsp, const char *label) { ! char me[]="miteVariableParse", err[AIR_STRLEN_MED], *buff, *endparen, ! *kqstr, *col, *kstr, *qstr; ! airArray *mop; ! ! if (!( qsp && label )) { sprintf(err, "%s: got NULL pointer", me); ! biffAdd(MITE, err); return 1; } ! mop = airMopNew(); ! buff = airStrdup(label); ! if (!buff) { ! sprintf(err, "%s: couldn't strdup label!", me); ! biffAdd(MITE, err); airMopError(mop); return 1; ! } ! airMopAdd(mop, buff, airFree, airMopAlways); ! if (strstr(buff, "gage(") == buff) { /* txf domain variable is to be measured directly by gage */ ! if (!(endparen = strstr(buff, ")"))) { sprintf(err, "%s: didn't see close paren after \"gage(\"", me); ! biffAdd(MITE, err); airMopError(mop); return 1; } ! *endparen = 0; ! kqstr = buff + strlen("gage("); ! /* first see if its a gageKindScl specification */ ! qsp->query = airEnumVal(gageScl, kqstr); ! if (-1 != qsp->query) { ! qsp->kind = gageKindScl; ! fprintf(stderr, "\n%s: WARNING: deprecated use of txf domain " ! "\"gage(%s)\" without explicit gage kind specification; " ! "should use \"gage(%s:%s)\" instead\n\n", ! me, kqstr, gageKindScl->name, kqstr); ! } else { ! /* should be of form "<kind>:<query>" */ ! col = strstr(kqstr, ":"); ! if (!col) { ! sprintf(err, "%s: didn't see \":\" seperator between gage " ! "kind and query", me); ! biffAdd(MITE, err); airMopError(mop); return 1; ! } ! *col = 0; ! kstr = kqstr; ! qstr = col+1; ! if (!strcmp(gageKindScl->name, kstr)) { ! qsp->kind = gageKindScl; ! } else if (!strcmp(gageKindVec->name, kstr)) { ! qsp->kind = gageKindVec; ! } else if (!strcmp(tenGageKind->name, kstr)) { ! qsp->kind = tenGageKind; ! } else { ! sprintf(err, "%s: don't recognized \"%s\" gage kind", me, kstr); ! biffAdd(MITE, err); airMopError(mop); return 1; ! } ! qsp->query = airEnumVal(qsp->kind->enm, qstr); ! if (-1 == qsp->query) { ! sprintf(err, "%s: couldn't parse \"%s\" as a %s varable", ! me, qstr, qsp->kind->name); ! biffAdd(MITE, err); airMopError(mop); return 1; ! } } ! } else if (strstr(buff, "mite(") == buff) { ! /* txf domain variable is *not* directly measured by gage */ ! if (!(endparen = strstr(buff, ")"))) { ! sprintf(err, "%s: didn't see close paren after \"mite(\"", me); ! biffAdd(MITE, err); airMopError(mop); return 1; } ! *endparen = 0; ! kqstr = buff + strlen("mite("); ! qsp->query = airEnumVal(miteVal, kqstr); ! if (-1 == qsp->query) { ! sprintf(err, "%s: couldn't parse \"%s\" as a miteVal variable", ! me, kqstr); ! biffAdd(MITE, err); airMopError(mop); return 1; ! } ! qsp->kind = miteValGageKind; } else { ! /* didn't start with "gage(" or "mite(" */ ! qsp->query = airEnumVal(miteVal, label); ! if (-1 != qsp->query) { ! /* its measured by mite */ ! qsp->kind = miteValGageKind; ! fprintf(stderr, "\n%s: WARNING: deprecated use of txf domain " ! "\"%s\"; should use \"mite(%s)\" instead\n\n", ! me, label, label); ! } else { ! sprintf(err, "%s: \"%s\" not a recognized variable", me, label); ! biffAdd(MITE, err); airMopError(mop); return 1; } } ! airMopOkay(mop); ! return 0; } int ! miteNtxfCheck(const Nrrd *ntxf) { char me[]="miteNtxfCheck", err[AIR_STRLEN_MED], *range, *domS; ! gageQuerySpec qsp; ! int rii, axi; if (nrrdCheck(ntxf)) { sprintf(err, "%s: basic nrrd validity check failed", me); *************** *** 179,186 **** biffAdd(MITE, err); return 1; } - if (1 == ntxf->dim) { - sprintf(err, "%s: dimension is 1, must be 2 or greater", me); - biffAdd(MITE, err); return 1; - } range = ntxf->axis[0].label; if (0 == airStrlen(range)) { --- 185,188 ---- *************** *** 193,229 **** biffAdd(MITE, err); return 1; } ! for (i=0; i<airStrlen(range); i++) { ! if (!strchr(miteRangeChar, range[i])) { sprintf(err, "%s: char %d of axis[0]'s label (\"%c\") isn't a valid " "transfer function range specifier (not in \"%s\")", ! me, i, range[i], miteRangeChar); biffAdd(MITE, err); return 1; } } ! for (i=1; i<ntxf->dim; i++) { ! if (!( AIR_EXISTS(ntxf->axis[i].min) && AIR_EXISTS(ntxf->axis[i].max) )) { ! sprintf(err, "%s: min and max of axis %d aren't both set", me, i); biffAdd(MITE, err); return 1; } ! if (!( ntxf->axis[i].min < ntxf->axis[i].max )) { sprintf(err, "%s: min (%g) not less than max (%g) on axis %d", ! me, ntxf->axis[i].min, ntxf->axis[i].max, i); biffAdd(MITE, err); return 1; } ! if (1 == ntxf->axis[i].size) { ! sprintf(err, "%s: # samples on axis %d must be > 1", me, i); biffAdd(MITE, err); return 1; } ! domS = ntxf->axis[i].label; if (0 == airStrlen(domS)) { sprintf(err, "%s: axis[%d] of txf didn't specify a domain variable", ! me, i); biffAdd(MITE, err); return 1; } ! if (-1 == _miteDomainParse(domS, kind)) { ! sprintf(err, "%s: problem with txf domain \"%s\" for axis %d\n", ! me, domS, i); biffAdd(MITE, err); return 1; } } --- 195,250 ---- biffAdd(MITE, err); return 1; } ! for (rii=0; rii<airStrlen(range); rii++) { ! if (!strchr(miteRangeChar, range[rii])) { sprintf(err, "%s: char %d of axis[0]'s label (\"%c\") isn't a valid " "transfer function range specifier (not in \"%s\")", ! me, rii, range[rii], miteRangeChar); biffAdd(MITE, err); return 1; } } ! for (axi=1; axi<ntxf->dim; axi++) { ! if (!( AIR_EXISTS(ntxf->axis[axi].min) && ! AIR_EXISTS(ntxf->axis[axi].max) )) { ! sprintf(err, "%s: min and max of axis %d aren't both set", me, axi); biffAdd(MITE, err); return 1; } ! if (!( ntxf->axis[axi].min < ntxf->axis[axi].max )) { sprintf(err, "%s: min (%g) not less than max (%g) on axis %d", ! me, ntxf->axis[axi].min, ntxf->axis[axi].max, axi); biffAdd(MITE, err); return 1; } ! if (1 == ntxf->axis[axi].size) { ! sprintf(err, "%s: # samples on axis %d must be > 1", me, axi); biffAdd(MITE, err); return 1; } ! domS = ntxf->axis[axi].label; if (0 == airStrlen(domS)) { sprintf(err, "%s: axis[%d] of txf didn't specify a domain variable", ! me, axi); biffAdd(MITE, err); return 1; } ! if (miteVariableParse(&qsp, domS)) { ! sprintf(err, "%s: couldn't parse txf domain \"%s\" for axis %d\n", ! me, domS, axi); biffAdd(MITE, err); return 1; } + if (!( 1 == qsp.kind->ansLength[qsp.query] || + 3 == qsp.kind->ansLength[qsp.query] )) { + sprintf(err, "%s: %s not a scalar or vector: can't be a txf " + "domain variable", me, domS); + biffAdd(MITE, err); return 1; + } + if (3 == qsp.kind->ansLength[qsp.query]) { + /* has to be right length for one of the quantization schemes */ + if (!( limnQNBins[limnQN16checker] == ntxf->axis[axi].size || + limnQNBins[limnQN14checker] == ntxf->axis[axi].size || + limnQNBins[limnQN12checker] == ntxf->axis[axi].size )) { + sprintf(err, "%s: vector %s can be quantized into %d, %d, or %d bins " + "but not %d", me, domS, limnQNBins[limnQN16checker], + limnQNBins[limnQN14checker], limnQNBins[limnQN12checker], + ntxf->axis[axi].size); + biffAdd(MITE, err); return 1; + } + } } *************** *** 231,256 **** } ! unsigned int ! _miteNtxfQuery(Nrrd *ntxf, gageKind *kind) { ! int i, dom; ! unsigned int query; ! ! query = 0; for (i=1; i<ntxf->dim; i++) { ! dom = _miteDomainParse(ntxf->axis[i].label, kind); ! if (AIR_IN_OP(gageSclUnknown, dom, gageSclLast)) { ! query |= 1 << dom; ! } else { ! /* of all places, this is where we set gage queries that ! are required for miteScl txf domain variables */ ! dom -= GAGE_SCL_MAX+1; ! switch(dom) { ! case miteSclNdotV: query |= 1 << gageSclNormal; break; ! case miteSclNdotL: query |= 1 << gageSclNormal; break; ! case miteSclGTdotV: query |= 1 << gageSclGeomTens; break; ! } } } ! return query; } --- 252,313 ---- } ! /* ! ** _miteQuery() ! ** ! ** This looks a given gageQuerySpec and sets the bits in the ! ** gageKindScl and tenGageKind queries that are required to calculate ! ** the quantity ! ** ! ** NOTE: This does NOT initialize the *query{Scl,Vec,Ten}: it ! ** just bit-wise or's on new stuff ! ** ! ** HEY: this is really unfortunate: each new gage type use for ! ** volume rendering in mite will have to explicitly added as ! ** arguments here, which is part of the reason that mite may end ! ** up explicitly depending on the libraries supplying those gageKinds ! ** (like how new mite depends on ten) ! */ ! void ! _miteQuery(unsigned int *queryScl, ! unsigned int *queryVec, ! unsigned int *queryTen, gageQuerySpec *qsp) { ! char me[]="_miteQuery"; ! ! /* for (i=1; i<ntxf->dim; i++) { ! miteVariableParse(qsp, ntxf->axis[i].label); ! */ ! if (gageKindScl == qsp->kind) { ! *queryScl |= 1 << qsp->query; ! } else if (gageKindVec == qsp->kind) { ! *queryVec |= 1 << qsp->query; ! } else if (tenGageKind == qsp->kind) { ! *queryTen |= 1 << qsp->query; ! } else if (miteValGageKind == qsp->kind) { ! /* HEY: the first of these two have useful analogs for tensor ! data, but I won't be able to express them ... */ ! switch(qsp->query) { ! case miteValNdotV: ! *queryScl |= 1 << gageSclNormal; ! break; ! case miteValNdotL: ! *queryScl |= 1 << gageSclNormal; ! break; ! case miteValGTdotV: ! *queryScl |= 1 << gageSclGeomTens; ! break; ! case miteValVrefN: ! *queryScl |= 1 << gageSclNormal; ! break; ! case miteValVdefT: ! case miteValVdefTdotV: ! *queryTen |= 1 << tenGageTensor; ! break; } + } else { + fprintf(stderr, "%s: PANIC: unrecognized non-null gageKind\n", me); + exit(1); } ! return; } *************** *** 272,276 **** if (!E) airMopAdd(mrr->rmop, mrr->ntxf[ni], (airMopper)nrrdNuke, airMopAlways); ! /* this assumes that ntxf type is float, double, or uchar */ switch(muu->ntxf[ni]->type) { case nrrdTypeUChar: --- 329,342 ---- if (!E) airMopAdd(mrr->rmop, mrr->ntxf[ni], (airMopper)nrrdNuke, airMopAlways); ! if (!( nrrdTypeUChar == muu->ntxf[ni]->type ! || nrrdTypeFloat == muu->ntxf[ni]->type ! || nrrdTypeDouble == muu->ntxf[ni]->type )) { ! sprintf(err, "%s: sorry, can't handle txf of type %s (only %s, %s, %s)", ! me, airEnumStr(nrrdType, muu->ntxf[ni]->type), ! airEnumStr(nrrdType, nrrdTypeUChar), ! airEnumStr(nrrdType, nrrdTypeFloat), ! airEnumStr(nrrdType, nrrdTypeDouble)); ! biffAdd(MITE, err); return 1; ! } switch(muu->ntxf[ni]->type) { case nrrdTypeUChar: *************** *** 280,284 **** if (!E) E |= nrrdCopy(mrr->ntxf[ni], muu->ntxf[ni]); break; ! default: if (!E) E |= nrrdConvert(mrr->ntxf[ni], muu->ntxf[ni], mite_nt); break; --- 346,350 ---- if (!E) E |= nrrdCopy(mrr->ntxf[ni], muu->ntxf[ni]); break; ! default: /* will be either float or double (whatever mite_nt isn't) */ if (!E) E |= nrrdConvert(mrr->ntxf[ni], muu->ntxf[ni], mite_nt); break; *************** *** 335,344 **** } int ! _miteStageSet(miteThread *mtt, miteRender *mrr, gageKind *kind) { char me[]="_miteStageSet", err[AIR_STRLEN_MED]; ! int ni, di, si, rii, dom, stageNum; Nrrd *ntxf; miteStage *stage; char rc; --- 401,428 ---- } + void + _miteStageInit(miteStage *stage) { + int rii; + + stage->val = NULL; + stage->size = -1; + stage->op = miteStageOpUnknown; + stage->qn = NULL; + stage->min = stage->max = AIR_NAN; + stage->data = NULL; + for (rii=0; rii<=MITE_RANGE_NUM-1; rii++) { + stage->rangeIdx[rii] = -1; + } + stage->rangeNum = -1; + return; + } + int ! _miteStageSet(miteThread *mtt, miteRender *mrr) { char me[]="_miteStageSet", err[AIR_STRLEN_MED]; ! int ni, di, stageIdx, rii, stageNum; Nrrd *ntxf; miteStage *stage; + gageQuerySpec qsp; char rc; *************** *** 352,367 **** airMopAdd(mrr->rmop, mtt->stage, airFree, airMopAlways); mtt->stageNum = stageNum; ! si = 0; for (ni=0; ni<mrr->ntxfNum; ni++) { ntxf = mrr->ntxf[ni]; for (di=ntxf->dim-1; di>=1; di--) { ! stage = mtt->stage + si; ! dom = _miteDomainParse(ntxf->axis[di].label, kind); ! if (AIR_IN_OP(gageSclUnknown, dom, gageSclLast)) { ! stage->val = mtt->ans + kind->ansOffset[dom]; } else { ! dom -= GAGE_SCL_MAX+1; ! stage->val = mtt->mscl + dom; } /* fprintf(stderr, "!%s: ans=%p + offset[%d]=%d == %p\n", me, --- 436,460 ---- airMopAdd(mrr->rmop, mtt->stage, airFree, airMopAlways); mtt->stageNum = stageNum; ! stageIdx = 0; for (ni=0; ni<mrr->ntxfNum; ni++) { ntxf = mrr->ntxf[ni]; for (di=ntxf->dim-1; di>=1; di--) { ! stage = mtt->stage + stageIdx; ! _miteStageInit(stage); ! miteVariableParse(&qsp, ntxf->axis[di].label); ! if (gageKindScl == qsp.kind) { ! stage->val = mtt->ansScl; ! } else if (gageKindVec == qsp.kind) { ! stage->val = mtt->ansVec; ! } else if (tenGageKind == qsp.kind) { ! stage->val = mtt->ansTen; ! } else if (miteValGageKind == qsp.kind) { ! stage->val = mtt->ansMiteVal; } else { ! sprintf(err, "%s: don't handle gageKind for \"%s\"", ! me, ntxf->axis[di].label); ! biffAdd(MITE, err); return 1; } + stage->val += qsp.kind->ansOffset[qsp.query]; /* fprintf(stderr, "!%s: ans=%p + offset[%d]=%d == %p\n", me, *************** *** 375,378 **** --- 468,493 ---- } else { stage->data = ntxf->data; + stage->op = miteStageOpMultiply; + if (1 == qsp.kind->ansLength[qsp.query]) { + stage->qn = NULL; + } else if (3 == 1 == qsp.kind->ansLength[qsp.query]) { + if (limnQNBins[limnQN16checker] == ntxf->axis[di].size) { + stage->qn = limnVtoQN_GT[limnQN16checker]; + } else if (limnQNBins[limnQN14checker] == ntxf->axis[di].size) { + stage->qn = limnVtoQN_GT[limnQN14checker]; + } else if (limnQNBins[limnQN12checker] == ntxf->axis[di].size) { + stage->qn = limnVtoQN_GT[limnQN12checker]; + } else { + sprintf(err, "%s: txf axis %d size %d not usable for vector " + "txf domain variable %s", me, + di, ntxf->axis[di].size, ntxf->axis[di].label); + biffAdd(MITE, err); return 1; + } + } else { + sprintf(err, "%s: %s not scalar or vector (len = %d): can't be " + "a txf domain variable", me, + ntxf->axis[di].label, qsp.kind->ansLength[qsp.query]); + biffAdd(MITE, err); return 1; + } stage->rangeNum = ntxf->axis[0].size; for (rii=0; rii<stage->rangeNum; rii++) { *************** *** 385,389 **** } } ! si++; } } --- 500,504 ---- } } ! stageIdx++; } } *************** *** 393,413 **** void _miteStageRun(miteThread *mtt) { ! int si, ri, rii, idx, index; miteStage *stage; mite_t *rangeData; ! index = 0; ! for (si=0; si<mtt->stageNum; si++) { ! stage = &(mtt->stage[si]); ! AIR_INDEX(stage->min, *(stage->val), stage->max, stage->size, idx); ! idx = AIR_CLAMP(0, idx, stage->size-1); ! index = stage->size*index + idx; if (stage->data) { ! rangeData = stage->data + stage->rangeNum*index; for (rii=0; rii<stage->rangeNum; rii++) { ri = stage->rangeIdx[rii]; mtt->range[ri] *= rangeData[rii]; } ! index = 0; } } --- 508,534 ---- void _miteStageRun(miteThread *mtt) { ! int stageIdx, ri, rii, txfIdx, finalIdx; miteStage *stage; mite_t *rangeData; ! finalIdx = 0; ! for (stageIdx=0; stageIdx<mtt->stageNum; stageIdx++) { ! stage = &(mtt->stage[stageIdx]); ! if (stage->qn) { ! /* its a vector-valued txf domain variable */ ! txfIdx = stage->qn(stage->val); ! } else { ! /* its a scalar txf domain variable */ ! AIR_INDEX(stage->min, *(stage->val), stage->max, stage->size, txfIdx); ! } ! txfIdx = AIR_CLAMP(0, txfIdx, stage->size-1); ! finalIdx = stage->size*finalIdx + txfIdx; if (stage->data) { ! rangeData = stage->data + stage->rangeNum*finalIdx; for (rii=0; rii<stage->rangeNum; rii++) { ri = stage->rangeIdx[rii]; mtt->range[ri] *= rangeData[rii]; } ! finalIdx = 0; } } Index: user.c =================================================================== RCS file: /cvsroot/teem/teem/src/mite/user.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** user.c 7 Jan 2004 15:34:30 -0000 1.13 --- user.c 13 Feb 2004 22:58:41 -0000 1.14 *************** *** 31,38 **** muu->umop = airMopNew(); ! muu->nin = NULL; muu->ntxf = NULL; /* managed by user (with miter: hest) */ muu->nout = NULL; /* managed by user (with miter: hest) */ muu->ntxfNum = 0; for (i=0; i<MITE_RANGE_NUM; i++) { muu->rangeInit[i] = 1.0; --- 31,41 ---- muu->umop = airMopNew(); ! muu->nsin = NULL; ! muu->nvin = NULL; ! muu->ntin = NULL; muu->ntxf = NULL; /* managed by user (with miter: hest) */ muu->nout = NULL; /* managed by user (with miter: hest) */ muu->ntxfNum = 0; + muu->shadeStr[0] = 0; for (i=0; i<MITE_RANGE_NUM; i++) { muu->rangeInit[i] = 1.0; *************** *** 52,57 **** muu->lit = limnLightNew(); airMopAdd(muu->umop, muu->lit, (airMopper)limnLightNix, airMopAlways); ! muu->justSum = AIR_FALSE; ! muu->noDirLight = AIR_FALSE; muu->rendTime = 0; muu->sampRate = 0; --- 55,60 ---- muu->lit = limnLightNew(); airMopAdd(muu->umop, muu->lit, (airMopper)limnLightNix, airMopAlways); ! muu->normalSide = miteDefNormalSide; ! muu->verbUi = muu->verbVi = -1; muu->rendTime = 0; muu->sampRate = 0; *************** *** 84,88 **** gotOpac = AIR_FALSE; for (T=0; T<muu->ntxfNum; T++) { ! if (miteNtxfCheck(muu->ntxf[T], gageKindScl)) { sprintf(err, "%s: ntxf[%d] (%d of %d) can't be used as a txf", me, T, T+1, muu->ntxfNum); --- 87,91 ---- gotOpac = AIR_FALSE; for (T=0; T<muu->ntxfNum; T++) { ! if (miteNtxfCheck(muu->ntxf[T])) { sprintf(err, "%s: ntxf[%d] (%d of %d) can't be used as a txf", me, T, T+1, muu->ntxfNum); *************** *** 92,97 **** } if (!gotOpac) { ! fprintf(stderr, "\n\n%s: !!! WARNING !!! opacity (\"A\") not set " ! "by any transfer function\n\n", me); } if (!muu->nout) { --- 95,104 ---- } if (!gotOpac) { ! fprintf(stderr, "\n\n%s: ****************************************" ! "************************\n", me); ! fprintf(stderr, "%s: !!! WARNING !!! opacity (\"A\") not set " ! "by any transfer function\n", me); ! fprintf(stderr, "%s: ****************************************" ! "************************\n\n\n", me); } if (!muu->nout) { *************** *** 99,105 **** biffAdd(MITE, err); return 1; } ! if (gageVolumeCheck(muu->gctx0, muu->nin, gageKindScl)) { ! sprintf(err, "%s: trouble with input volume", me); ! biffMove(MITE, err, GAGE); return 1; } --- 106,123 ---- biffAdd(MITE, err); return 1; } ! if (!(muu->nsin || muu->ntin)) { ! sprintf(err, "%s: got neither scalar nor tensor volume", me); ! biffAdd(MITE, err); return 1; ! } ! if (muu->nsin) { ! if (gageVolumeCheck(muu->gctx0, muu->nsin, gageKindScl)) { ! sprintf(err, "%s: trouble with input scalar volume", me); ! biffMove(MITE, err, GAGE); return 1; ! } ! } else { ! if (gageVolumeCheck(muu->gctx0, muu->ntin, tenGageKind)) { ! sprintf(err, "%s: trouble with input tensor volume", me); ! biffMove(MITE, err, GAGE); return 1; ! } } |
|
From: <kin...@us...> - 2004-02-13 23:03:35
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29503/test Modified Files: off2eps.c soid.c Log Message: added option to NOT initially fill the background color in the bounding box area Index: off2eps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/off2eps.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** off2eps.c 10 Feb 2004 09:26:53 -0000 1.5 --- off2eps.c 13 Feb 2004 22:57:30 -0000 1.6 *************** *** 35,39 **** Nrrd *nmap; FILE *file; ! int wire, concave, describe, reverse; mop = airMopNew(); --- 35,39 ---- Nrrd *nmap; FILE *file; ! int wire, concave, describe, reverse, nobg; mop = airMopNew(); *************** *** 73,76 **** --- 73,78 ---- hestOptAdd(&hopt, "describe", NULL, airTypeInt, 0, 0, &describe, NULL, "for debugging: list object definition of OFF read"); + hestOptAdd(&hopt, "nobg", NULL, airTypeInt, 0, 0, &nobg, NULL, + "don't initially fill with background color"); hestOptAdd(&hopt, "wd", "5 widths", airTypeFloat, 5, 5, edgeWidth, "0.0 0.0 3.0 2.0 0.0", *************** *** 105,113 **** } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); - lookIdx = airArrayIncrLen(obj->lookArr, 2); - look = obj->look + lookIdx + 0; - ELL_4V_SET(look->rgba, 1, 1, 1, 1); /* this is kind of silly */ - ELL_3V_SET(look->kads, 0.2, 0.8, 0); - look->spow = 0; if (limnObjectOFFRead(obj, file)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); --- 107,110 ---- *************** *** 141,144 **** --- 138,142 ---- win->ps.wireFrame = wire; win->ps.creaseAngle = creaseAngle; + win->ps.noBackground = nobg; win->file = airFopen(outS, stdout, "w"); *************** *** 146,149 **** --- 144,154 ---- win->scale = winscale; + for (lookIdx=0; lookIdx<obj->lookNum; lookIdx++) { + look = obj->look + lookIdx; + /* earlier version of limn/test/soid used (0.2,0.8,0.0), I think. + Now we assume that any useful shading is happening in the emap */ + ELL_3V_SET(look->kads, 0.2, 0.8, 0); + } + if (limnObjectRender(obj, cam, win) || (concave Index: soid.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/soid.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** soid.c 10 Feb 2004 09:26:53 -0000 1.9 --- soid.c 13 Feb 2004 22:57:30 -0000 1.10 *************** *** 53,57 **** main(int argc, char *argv[]) { 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; --- 53,57 ---- main(int argc, char *argv[]) { char *me, *err, *outS; ! float p[3], q[4], mR[9], eval[3], scale[3], len, sh, cl, cp, qA, qB; float matA[16], matB[16], os, rad, edgeWidth[5], AB[2]; hestOpt *hopt=NULL; *************** *** 68,72 **** edgeWidth[1] = 0; me = argv[0]; ! 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", --- 68,72 ---- edgeWidth[1] = 0; me = argv[0]; ! hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, scale, "1 1 1", "axis-aligned scaling to do on ellipsoid"); hestOptAdd(&hopt, "AB", "A, B exponents", airTypeFloat, 2, 2, AB, "nan nan", *************** *** 122,135 **** 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); --- 122,136 ---- axis = 2; } else { ! ELL_3V_SCALE(scale, os, scale); ! ELL_3V_COPY(eval, scale); 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(scale[0], scale[1], scale[2]); qA = pow(1-cp, sh); qB = pow(1-cl, sh); } else { ! axis = ELL_MIN3_IDX(scale[0], scale[1], scale[2]); qA = pow(1-cl, sh); qB = pow(1-cp, sh); *************** *** 149,153 **** part = obj->part + partIdx; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, eval[0], eval[1], eval[2]); ell_4m_post_mul_f(matA, matB); ELL_43M_INSET(matB, mR); --- 150,154 ---- part = obj->part + partIdx; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, scale[0], scale[1], scale[2]); ell_4m_post_mul_f(matA, matB); ELL_43M_INSET(matB, mR); |
|
From: <kin...@us...> - 2004-02-13 23:03:35
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29503 Modified Files: limn.h methodsLimn.c obj.c renderLimn.c Log Message: added option to NOT initially fill the background color in the bounding box area Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** limn.h 10 Feb 2004 09:26:52 -0000 1.47 --- limn.h 13 Feb 2004 22:57:29 -0000 1.48 *************** *** 143,147 **** bg[3]; /* background color */ int showpage, /* finish with "showpage" */ ! wireFrame; /* just render wire-frame */ } limnOptsPS; --- 143,148 ---- bg[3]; /* background color */ int showpage, /* finish with "showpage" */ ! wireFrame, /* just render wire-frame */ ! noBackground; /* refrain from initially filling with bg[] color */ } limnOptsPS; *************** *** 440,444 **** extern int limnObjectSpaceTransform(limnObject *obj, limnCamera *cam, limnWindow *win, int space); ! extern int limnObjectPartTransform(limnObject *obj, int ri, float tx[16]); extern int limnObjectDepthSortParts(limnObject *obj); extern int limnObjectDepthSortFaces(limnObject *obj); --- 441,445 ---- extern int limnObjectSpaceTransform(limnObject *obj, limnCamera *cam, limnWindow *win, int space); ! extern int limnObjectPartTransform(limnObject *obj, int partIdx, float tx[16]); extern int limnObjectDepthSortParts(limnObject *obj); extern int limnObjectDepthSortFaces(limnObject *obj); Index: methodsLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/methodsLimn.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** methodsLimn.c 9 Feb 2004 22:48:01 -0000 1.11 --- methodsLimn.c 13 Feb 2004 22:57:30 -0000 1.12 *************** *** 82,85 **** --- 82,86 ---- ps->showpage = AIR_FALSE; ps->wireFrame = AIR_FALSE; + ps->noBackground = AIR_FALSE; ELL_3V_SET(ps->bg, 1, 1, 1); } Index: obj.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/obj.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** obj.c 10 Feb 2004 04:42:18 -0000 1.18 --- obj.c 13 Feb 2004 22:57:30 -0000 1.19 *************** *** 29,33 **** look = &(obj->look[lookIdx]); ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 0.5, 0.5, 0.0); look->spow = 50; return lookIdx; --- 29,33 ---- look = &(obj->look[lookIdx]); ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 0.0, 1.0, 0.0); look->spow = 50; return lookIdx; Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** renderLimn.c 10 Feb 2004 09:26:53 -0000 1.20 --- renderLimn.c 13 Feb 2004 22:57:30 -0000 1.21 *************** *** 67,72 **** fprintf(win->file, "%g %g lineto\n", win->bbox[0], win->bbox[3]); fprintf(win->file, "closepath\n"); ! fprintf(win->file, "gsave %g %g %g setrgbcolor fill grestore\n", ! win->ps.bg[0], win->ps.bg[1], win->ps.bg[2]); fprintf(win->file, "clip\n"); fprintf(win->file, "gsave newpath\n"); --- 67,74 ---- fprintf(win->file, "%g %g lineto\n", win->bbox[0], win->bbox[3]); fprintf(win->file, "closepath\n"); ! if (!win->ps.noBackground) { ! fprintf(win->file, "gsave %g %g %g setrgbcolor fill grestore\n", ! win->ps.bg[0], win->ps.bg[1], win->ps.bg[2]); ! } fprintf(win->file, "clip\n"); fprintf(win->file, "gsave newpath\n"); |
Update of /cvsroot/teem/teem/src/gage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29091 Modified Files: GNUmakefile gage.h miscGage.c print.c pvl.c scl.c sclanswer.c sclfilter.c st.c update.c vecGage.c Log Message: massive internal changes, but hopefully only the followin are visible: API CHANGE: unsigned int queries are gone; now using gageQuery, a bit-vector based on an array of uchars. So, where you used to say: unsigned int query; ... gageQuerySet(ctx, pvl, 1 << gageSclValue | 1 << gageSclGradMag) you'll now say: gageQuery query; ... GAGE_QUERY_RESET(query); GAGE_QUERY_ITEM_ON(query, gageSclValue); GAGE_QUERY_ITEM_ON(query, gageSclGradMag); gageQuerySet(ctx, pvl, query); or, less annoyingly (perhaps): gageQueryReset(ctx, pvl); gageQueryItemOn(ctx, pvl, gageSclValue); gageQueryItemOn(ctx, pvl, gageSclGradMag); API CHANGE: many of the arrays in the gageKind have been replaced by a single array of things called gageItemEntry, which is must easier to maintain by hand. See gage.h for details. Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/gage/GNUmakefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GNUmakefile 7 Jan 2004 15:34:29 -0000 1.13 --- GNUmakefile 13 Feb 2004 22:56:15 -0000 1.14 *************** *** 47,55 **** $(L).PUBLIC_HEADERS = gage.h $(L).PRIVATE_HEADERS = privateGage.h ! $(L).OBJS = defaultsGage.o miscGage.o print.o filter.o update.o \ ! scl.o sclfilter.o sclprint.o sclanswer.o \ ! vecGage.o vecprint.o ! $(L).OBJS = defaultsGage.o miscGage.o shape.o pvl.o ctx.o update.o filter.o \ ! print.o scl.o sclanswer.o sclprint.o sclfilter.o \ vecGage.o vecprint.o st.o $(L).TESTS = --- 47,53 ---- $(L).PUBLIC_HEADERS = gage.h $(L).PRIVATE_HEADERS = privateGage.h ! $(L).OBJS = defaultsGage.o miscGage.o scl.o kind.o \ ! shape.o pvl.o ctx.o update.o filter.o \ ! print.o sclanswer.o sclprint.o sclfilter.o \ vecGage.o vecprint.o st.o $(L).TESTS = Index: gage.h =================================================================== RCS file: /cvsroot/teem/teem/src/gage/gage.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** gage.h 16 Jan 2004 17:35:12 -0000 1.58 --- gage.h 13 Feb 2004 22:56:15 -0000 1.59 *************** *** 55,58 **** --- 55,65 ---- /* + ** terminology: gage is intended to measure multiple things at one + ** point in a volume. The SET of ALL the things that you want + ** gage to measure is called the "QUERY". Each of the many quantities + ** comprising the query are called "ITEM"s. + */ + + /* ******** gage_t ** *************** *** 181,188 **** #define GAGE_KERNEL_NUM 6 /* ** modifying the enums below (scalar, vector, etc query quantities) ! ** necesitates modifying the associated arrays in arrays.c, the arrays ! ** in enums.c, and obviously the "answer" method itself. */ --- 188,226 ---- #define GAGE_KERNEL_NUM 6 + #define GAGE_ITEM_PREREQ_NUM 5 + /* + ******** gageItemEntry struct + ** + ** necessary information about each item supported by the kind, which + ** is defined at compile-time in a per-kind table (at least it is for + ** the scalar, vector, and tensor kinds) + */ + typedef struct { + int enumVal, /* the item's enum value */ + answerLength, /* how many gage_t's are needed to store the answer */ + needDeriv, /* what kind of derivative info is immediately needed + for this item (not recursively expanded). This is + NO LONGER a bitvector: values are 0, 1, 2, ... */ + prereq[GAGE_ITEM_PREREQ_NUM], + /* what are the other items this item depends on + (not recusively expanded). The move away from + bit-vectors based on primitive types is what + necessitates conveying this with a stupid little + array. */ + parentItem, /* the enum value of an item (answerLength > 1) + containing the smaller value for which we are + merely an alias + OR: -1 if there's no parent */ + parentIndex; /* where our value starts in parents value + OR: -1 if there's no parent */ + } gageItemEntry; + /* ** modifying the enums below (scalar, vector, etc query quantities) ! ** necesitates modifying: ! ** - the central item table ! ** - the associated arrays in arrays.c ! ** - the arrays in enums.c, ! ** - the "answer" method itself. */ *************** *** 190,200 **** ******** gageScl* enum ** ! ** all the things that gage can measure in a scalar volume. The query is ! ** formed by a bitwise-or of left-shifts of 1 by these values: ! ** (1<<gageSclValue)|(1<<gageSclGradMag)|(1<<gageScl2ndDD) ! ** queries for the value, gradient magnitude, and 2nd directional derivative. ! ** The un-bit-shifted values are required for gage to index arrays like ! ** gageSclAnsOffset[], _gageSclNeedDeriv[], _gageSclPrereq[], etc, and ! ** for the gageScl airEnum. ** ** NOTE: although it is currently listed that way, it is not necessary --- 228,232 ---- ******** gageScl* enum ** ! ** all the "items" that gage can measure in a scalar volume. ** ** NOTE: although it is currently listed that way, it is not necessary *************** *** 209,270 **** enum { gageSclUnknown=-1, /* -1: nobody knows */ ! gageSclValue, /* 0: "v", data value: *GT */ gageSclGradVec, /* 1: "grad", gradient vector, un-normalized: GT[3] */ ! gageSclGradMag, /* 2: "gm", gradient magnitude: *GT */ gageSclNormal, /* 3: "n", gradient vector, normalized: GT[3] */ gageSclNPerp, /* 4: "np", projection onto tangent plane: GT[9] */ gageSclHessian, /* 5: "h", Hessian: GT[9] (column-order) */ ! gageSclLaplacian, /* 6: "l", Laplacian: Dxx + Dyy + Dzz: *GT */ gageSclHessEval, /* 7: "heval", Hessian's eigenvalues: GT[3] */ ! gageSclHessEvec, /* 8: "hevec", Hessian's eigenvectors: GT[9] */ ! gageScl2ndDD, /* 9: "2d", 2nd dir.deriv. along gradient: *GT */ ! gageSclGeomTens, /* 10: "gten", sym. matx w/ evals 0,K1,K2 and evecs grad, ! curvature directions: GT[9] */ ! gageSclK1, /* 11: "k1", 1st principle curvature: *GT */ ! gageSclK2, /* 12: "k2", 2nd principle curvature (k2 <= k1): *GT */ ! gageSclCurvedness, /* 13: "cv", L2 norm of K1, K2 (not Koen.'s "C"): *GT */ ! gageSclShapeTrace, /* 14, "st", (K1+K2)/Curvedness: *GT */ ! gageSclShapeIndex, /* 15: "si", Koen.'s shape index, ("S"): *GT */ ! gageSclMeanCurv, /* 16: "mc", mean curvature (K1 + K2)/2: *GT */ ! gageSclGaussCurv, /* 17: "gc", gaussian curvature K1*K2: *GT */ ! gageSclCurvDir, /* 18: "cdir", principle curvature directions: GT[6] */ ! gageSclFlowlineCurv,/* 19: "fc", curvature of normal streamline: *GT */ gageSclLast }; ! #define GAGE_SCL_MAX 19 ! #define GAGE_SCL_TOTAL_ANS_LENGTH 63 ! ! /* ! ******** GAGE_SCL_*_BIT #defines ! ** already bit-shifted for you, so that query: ! ** (1<<gageSclValue)|(1<<gageSclGradMag)|(1<<gageScl2ndDD) ! ** is same as: ! ** GAGE_SCL_VALUE_BIT | GAGE_SCL_GRADMAG_BIT | GAGE_SCL_2NDDD_BIT ! */ ! #define GAGE_SCL_VALUE_BIT (1<<0) ! #define GAGE_SCL_GRADVEC_BIT (1<<1) ! #define GAGE_SCL_GRADMAG_BIT (1<<2) ! #define GAGE_SCL_NORMAL_BIT (1<<3) ! #define GAGE_SCL_NPERP_BIT (1<<4) ! #define GAGE_SCL_HESSIAN_BIT (1<<5) ! #define GAGE_SCL_LAPLACIAN_BIT (1<<6) ! #define GAGE_SCL_HESSEVAL_BIT (1<<7) ! #define GAGE_SCL_HESSEVEC_BIT (1<<8) ! #define GAGE_SCL_2NDDD_BIT (1<<9) ! #define GAGE_SCL_GEOMTENS_BIT (1<<10) ! #define GAGE_SCL_K1_BIT (1<<11) ! #define GAGE_SCL_K2_BIT (1<<12) ! #define GAGE_SCL_CURVEDNESS_BIT (1<<13) ! #define GAGE_SCL_SHAPETRACE_BIT (1<<14) ! #define GAGE_SCL_SHAPEINDEX_BIT (1<<15) ! #define GAGE_SCL_MEANCURV_BIT (1<<16) ! #define GAGE_SCL_GAUSSCURV_BIT (1<<17) ! #define GAGE_SCL_CURVDIR_BIT (1<<18) ! #define GAGE_SCL_FLOWLINECURV_BIT (1<<19) /* ******** gageVec* enum ** ! ** all the things that gage knows how to measure in a 3-vector volume ** ** The strings gives one of the gageVec airEnum identifiers, and GT[x] --- 241,280 ---- enum { gageSclUnknown=-1, /* -1: nobody knows */ ! gageSclValue, /* 0: "v", data value: GT[1] */ gageSclGradVec, /* 1: "grad", gradient vector, un-normalized: GT[3] */ ! gageSclGradMag, /* 2: "gm", gradient magnitude: GT[1] */ gageSclNormal, /* 3: "n", gradient vector, normalized: GT[3] */ gageSclNPerp, /* 4: "np", projection onto tangent plane: GT[9] */ gageSclHessian, /* 5: "h", Hessian: GT[9] (column-order) */ ! gageSclLaplacian, /* 6: "l", Laplacian: Dxx + Dyy + Dzz: GT[1] */ gageSclHessEval, /* 7: "heval", Hessian's eigenvalues: GT[3] */ ! gageSclHessEval0, /* 8: "heval0", Hessian's 1st eigenvalue: GT[1] */ ! gageSclHessEval1, /* 9: "heval1", Hessian's 2nd eigenvalue: GT[1] */ ! gageSclHessEval2, /* 10: "heval2", Hessian's 3rd eigenvalue: GT[1] */ ! gageSclHessEvec, /* 11: "hevec", Hessian's eigenvectors: GT[9] */ ! gageSclHessEvec0, /* 12: "hevec0", Hessian's 1st eigenvector: GT[3] */ ! gageSclHessEvec1, /* 13: "hevec1", Hessian's 2nd eigenvector: GT[3] */ ! gageSclHessEvec2, /* 14: "hevec2", Hessian's 3rd eigenvector: GT[3] */ ! gageScl2ndDD, /* 15: "2d", 2nd dir.deriv. along gradient: GT[1] */ ! gageSclGeomTens, /* 16: "gten", sym. matx w/ evals {0, K1, K2} and ! evecs {grad, cdir0, cdir1}: GT[9] */ ! gageSclK1, /* 17: "k1", 1st principle curvature: GT[1] */ ! gageSclK2, /* 18: "k2", 2nd principle curvature (k2 <= k1): GT[1] */ ! gageSclCurvedness, /* 19: "cv", L2 norm(K1,K2) (not Koen.'s "C"): GT[1] */ ! gageSclShapeTrace, /* 20, "st", (K1+K2)/Curvedness: GT[1] */ ! gageSclShapeIndex, /* 21: "si", Koen.'s shape index, ("S"): GT[1] */ ! gageSclMeanCurv, /* 22: "mc", mean curvature (K1 + K2)/2: GT[1] */ ! gageSclGaussCurv, /* 23: "gc", gaussian curvature K1*K2: GT[1] */ ! gageSclCurvDir1, /* 24: "cdir1", 1st principle curv direction: GT[3] */ ! gageSclCurvDir2, /* 25: "cdir2", 2nd principle curv direction: GT[3] */ ! gageSclFlowlineCurv,/* 26: "fc", curvature of normal streamline: GT[1] */ gageSclLast }; ! #define GAGE_SCL_ITEM_MAX 26 /* ******** gageVec* enum ** ! ** all the "items" that gage knows how to measure in a 3-vector volume ** ** The strings gives one of the gageVec airEnum identifiers, and GT[x] *************** *** 274,278 **** gageVecUnknown=-1, /* -1: nobody knows */ gageVecVector, /* 0: "v", component-wise-intrpolated (CWI) vec: GT[3] */ ! gageVecLength, /* 1: "l", length of CWI vector: *GT */ gageVecNormalized, /* 2: "n", normalized CWI vector: GT[3] */ gageVecJacobian, /* 3: "j", component-wise Jacobian: GT[9] --- 284,288 ---- gageVecUnknown=-1, /* -1: nobody knows */ gageVecVector, /* 0: "v", component-wise-intrpolated (CWI) vec: GT[3] */ ! gageVecLength, /* 1: "l", length of CWI vector: GT[1] */ gageVecNormalized, /* 2: "n", normalized CWI vector: GT[3] */ gageVecJacobian, /* 3: "j", component-wise Jacobian: GT[9] *************** *** 280,310 **** 1:dv_y/dx 4:dv_y/dy 7:dv_y/dz 2:dv_z/dx 5:dv_z/dy 8:dv_z/dz */ ! gageVecDivergence, /* 4: "d", divergence (based on Jacobian): *GT */ gageVecCurl, /* 5: "c", curl (based on Jacobian): GT[3] */ ! gageVecGradient0, /* 6: "g1", gradient of 1st component of vector: GT[3] */ ! gageVecGradient1, /* 7: "g2", gradient of 2nd component of vector: GT[3] */ ! gageVecGradient2, /* 8: "g3", gradient of 3rd component of vector: GT[3] */ gageVecMultiGrad, /* 9: "mg", sum of outer products of gradients: GT[9] */ ! gageVecMGFrob, /* 10: "mgfrob", frob norm of multi-gradient: *GT */ gageVecMGEval, /* 11: "mgeval", eigenvalues of multi-gradient: GT[3] */ gageVecMGEvec, /* 12: "mgevec", eigenvectors of multi-gradient: GT[9] */ gageVecLast }; ! #define GAGE_VEC_MAX 12 ! #define GAGE_VEC_TOTAL_ANS_LENGTH 51 ! ! #define GAGE_VEC_VECTOR_BIT (1<<0) ! #define GAGE_VEC_LENGTH_BIT (1<<1) ! #define GAGE_VEC_NORMALIZED_BIT (1<<2) ! #define GAGE_VEC_JACOBIAN_BIT (1<<3) ! #define GAGE_VEC_DIVERGENCE_BIT (1<<4) ! #define GAGE_VEC_CURL_BIT (1<<5) ! #define GAGE_VEC_GRADIENT0_BIT (1<<6) ! #define GAGE_VEC_GRADIENT1_BIT (1<<7) ! #define GAGE_VEC_GRADIENT2_BIT (1<<8) ! #define GAGE_VEC_MULTIGRAD_BIT (1<<9) ! #define GAGE_VEC_MGFROB_BIT (1<<10) ! #define GAGE_VEC_MGEVAL_BIT (1<<11) ! #define GAGE_VEC_MGEVEC_BIT (1<<12) struct gageKind_t; /* dumb forward declaraction, ignore */ --- 290,305 ---- 1:dv_y/dx 4:dv_y/dy 7:dv_y/dz 2:dv_z/dx 5:dv_z/dy 8:dv_z/dz */ ! gageVecDivergence, /* 4: "d", divergence (based on Jacobian): GT[1] */ gageVecCurl, /* 5: "c", curl (based on Jacobian): GT[3] */ ! gageVecGradient0, /* 6: "g0", gradient of 1st component of vector: GT[3] */ ! gageVecGradient1, /* 7: "g1", gradient of 2nd component of vector: GT[3] */ ! gageVecGradient2, /* 8: "g2", gradient of 3rd component of vector: GT[3] */ gageVecMultiGrad, /* 9: "mg", sum of outer products of gradients: GT[9] */ ! gageVecMGFrob, /* 10: "mgfrob", frob norm of multi-gradient: GT[1] */ gageVecMGEval, /* 11: "mgeval", eigenvalues of multi-gradient: GT[3] */ gageVecMGEvec, /* 12: "mgevec", eigenvectors of multi-gradient: GT[9] */ gageVecLast }; ! #define GAGE_VEC_ITEM_MAX 12 struct gageKind_t; /* dumb forward declaraction, ignore */ *************** *** 423,426 **** --- 418,460 ---- /* + ******** gageQuery typedef + ** + ** this short, fixed-length array is used as a bit-vector to store + ** all the items that comprise a query. Its length sets an upper + ** bound on the maximum item value that a gageKind may use. + ** + ** The important thing to keep in mind is that a variable of type + ** gageKind ends up being passed by reference, even though the + ** syntax of its usage doesn't immediately announce that. + ** + ** gageKindCheck currently has the role of verifying that a gageKind's + ** maximum item value is within the bounds set here. Using + ** GAGE_QUERY_BYTES_NUM == 8 gives a max item value of 63, which is + ** far above anything being used now. + */ + #define GAGE_QUERY_BYTES_NUM 8 + #define GAGE_ITEM_MAX ((8*GAGE_QUERY_BYTES_NUM)-1) + typedef unsigned char gageQuery[GAGE_QUERY_BYTES_NUM]; + + /* + ******** GAGE_QUERY_RESET, GAGE_QUERY_TEST + ******** GAGE_QUERY_ON, GAGE_QUERY_OFF + ** + ** Macros for manipulating a gageQuery. + ** + ** airSanity ensures that an unsigned char is in fact 8 bits + */ + #define GAGE_QUERY_RESET(q) (q[0]=q[1]=q[2]=q[3]=q[4]=q[5]=q[6]=q[7]=0) + #define GAGE_QUERY_COPY(p, q) \ + p[0] = q[0]; p[1] = q[1]; p[2] = q[2]; p[3] = q[3]; \ + p[4] = q[4]; p[5] = q[5]; p[6] = q[6]; p[7] = q[7] + #define GAGE_QUERY_EQUAL(p, q) \ + (p[0] == q[0] && p[1] == q[1] && p[2] == q[2] && p[3] == q[3] \ + && p[4] == q[4] && p[5] == q[5] && p[6] == q[6] && p[7] == q[7]) + #define GAGE_QUERY_ITEM_TEST(q, i) (q[i/8] & (1 << (i % 8))) + #define GAGE_QUERY_ITEM_ON(q, i) (q[i/8] |= (1 << (i % 8))) + #define GAGE_QUERY_ITEM_OFF(q, i) (q[i/8] &= ^(1 << (i % 8))) + + /* ******** gageContext struct ** *************** *** 482,486 **** thisIsACopy; /* I'm a copy */ struct gageKind_t *kind; /* what kind of volume is this pervolume for */ ! unsigned int query; /* the query, recursively expanded */ int needD[3]; /* which derivatives need to be calculated for the query (above) in this volume */ --- 516,520 ---- thisIsACopy; /* I'm a copy */ struct gageKind_t *kind; /* what kind of volume is this pervolume for */ ! gageQuery query; /* the query, recursively expanded */ int needD[3]; /* which derivatives need to be calculated for the query (above) in this volume */ *************** *** 508,513 **** /* nrrd{F,D}Lookup[] element, according to npad->type and gage_t */ ! gage_t *ans; /* array of length kind->totalAnsLen, to hold ! all answers */ } gagePerVolume; --- 542,547 ---- /* nrrd{F,D}Lookup[] element, according to npad->type and gage_t */ ! gage_t *answer; /* main buffer to hold all the answers */ ! gage_t **directAnswer; /* array of pointers into answer */ } gagePerVolume; *************** *** 526,536 **** (0 for scalars, 1 for vectors) */ valLen, /* number of scalars per data point */ ! queryMax, /* such as GAGE_SCL_MAX */ ! *ansLength, /* such as gageSclAnsLength */ ! *ansOffset, /* such as gageSclAnsOffset */ ! totalAnsLen, /* such as GAGE_SCL_TOTAL_ANS_LENGTH */ ! *needDeriv; /* such as _gageSclNeedDeriv */ ! unsigned int *queryPrereq; /* such as _gageSclPrereq; */ ! void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */ gageContext *, --- 560,566 ---- (0 for scalars, 1 for vectors) */ valLen, /* number of scalars per data point */ ! itemMax; /* such as GAGE_SCL_ITEM_MAX */ ! gageItemEntry *table; /* array of gageItemEntry's, indexed ! by the item value */ void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */ gageContext *, *************** *** 542,556 **** } gageKind; - - /* the "answer structs" are gone- now we're just using the bare array - "ans" in the gagePerVolume, more easily used with help from - gageAnswerPointer() or ... */ - /* ! ******** #define GAGE_ANSWER_POINTER() ** ! ** a non-error-checking version of gageAnswerPointer() */ ! #define GAGE_ANSWER_POINTER(pvl, m) ((pvl)->ans + (pvl)->kind->ansOffset[(m)]) /* defaultsGage.c */ --- 572,584 ---- } gageKind; /* ! ******** gageItemSpec struct ** ! ** dumb little way to store an item/kind pair */ ! typedef struct { ! int item; /* the quantity we care about */ ! gageKind *kind; /* what kind it comes from */ ! } gageItemSpec; /* defaultsGage.c */ *************** *** 580,586 **** extern void gageParmReset(gageParm *parm); extern void gagePointReset(gagePoint *point); /* print.c */ ! extern void gageQueryPrint(FILE *file, gageKind *kind, unsigned int query); /* sclfilter.c */ --- 608,621 ---- extern void gageParmReset(gageParm *parm); extern void gagePointReset(gagePoint *point); + extern gageItemSpec *gageItemSpecNew(void); + extern gageItemSpec *gageItemSpecNix(gageItemSpec *isp); + + /* kind.c */ + extern int gageKindCheck(gageKind *kind); + extern int gageKindTotalAnswerLength(gageKind *kind); + extern int gageKindAnswerOffset(gageKind *kind, int item); /* print.c */ ! extern void gageQueryPrint(FILE *file, gageKind *kind, gageQuery query); /* sclfilter.c */ *************** *** 600,605 **** /* scl.c */ - extern gage_export int gageSclAnsLength[GAGE_SCL_MAX+1]; - extern gage_export int gageSclAnsOffset[GAGE_SCL_MAX+1]; extern gage_export airEnum *gageScl; extern gage_export gageKind *gageKindScl; --- 635,638 ---- *************** *** 608,613 **** implement the "vec" kind, and could be used as examples of what it takes to create a new gageKind) */ - extern gage_export int gageVecAnsLength[GAGE_VEC_MAX+1]; - extern gage_export int gageVecAnsOffset[GAGE_VEC_MAX+1]; extern gage_export airEnum *gageVec; extern gage_export gageKind *gageKindVec; --- 641,644 ---- *************** *** 638,644 **** gagePerVolume *pvl, gageNixer_t *nixer); extern gage_t *gageAnswerPointer(gageContext *ctx, ! gagePerVolume *pvl, int measure); ! extern int gageQuerySet(gageContext *ctx, ! gagePerVolume *pvl, unsigned int query); /* ctx.c */ --- 669,676 ---- gagePerVolume *pvl, gageNixer_t *nixer); extern gage_t *gageAnswerPointer(gageContext *ctx, ! gagePerVolume *pvl, int item); ! extern int gageQueryReset(gageContext *ctx, gagePerVolume *pvl); ! extern int gageQuerySet(gageContext *ctx, gagePerVolume *pvl, gageQuery query); ! extern int gageQueryItemOn(gageContext *ctx, gagePerVolume *pvl, int item); /* ctx.c */ Index: miscGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/miscGage.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** miscGage.c 7 Jan 2004 15:34:29 -0000 1.9 --- miscGage.c 13 Feb 2004 22:56:15 -0000 1.10 *************** *** 214,215 **** --- 214,236 ---- return; } + + gageItemSpec * + gageItemSpecNew(void) { + gageItemSpec *isp; + + isp = (gageItemSpec *)calloc(1, sizeof(gageItemSpec)); + if (isp) { + isp->item = -1; + isp->kind = NULL; + } + return isp; + } + + gageItemSpec * + gageItemSpecNix(gageItemSpec *isp) { + + if (isp) { + AIR_FREE(isp); + } + return NULL; + } Index: print.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/print.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** print.c 7 Jan 2004 15:34:29 -0000 1.14 --- print.c 13 Feb 2004 22:56:15 -0000 1.15 *************** *** 165,178 **** void ! gageQueryPrint (FILE *file, gageKind *kind, unsigned int query) { ! unsigned int q; ! fprintf(file, "%s query = %u ...\n", kind->name, query); ! q = kind->queryMax+1; do { ! q--; ! if ((1<<q) & query) { ! fprintf(file, " %3d: %s\n", q, airEnumStr(kind->enm, q)); } ! } while (q); } --- 165,178 ---- void ! gageQueryPrint (FILE *file, gageKind *kind, gageQuery query) { ! int ii; ! fprintf(file, "%s query = ...\n", kind->name); ! ii = kind->itemMax+1; do { ! ii--; ! if (GAGE_QUERY_ITEM_TEST(query, ii)) { ! fprintf(file, " %3d: %s\n", ii, airEnumStr(kind->enm, ii)); } ! } while (ii); } Index: pvl.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/pvl.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pvl.c 7 Jan 2004 15:34:29 -0000 1.9 --- pvl.c 13 Feb 2004 22:56:15 -0000 1.10 *************** *** 52,56 **** char me[]="gagePerVolumeNew", err[AIR_STRLEN_MED]; gagePerVolume *pvl; ! int i; if (!( nin && kind )) { --- 52,56 ---- char me[]="gagePerVolumeNew", err[AIR_STRLEN_MED]; gagePerVolume *pvl; ! int ii; if (!( nin && kind )) { *************** *** 70,74 **** pvl->verbose = gageDefVerbose; pvl->kind = kind; ! pvl->query = 0; pvl->needD[0] = pvl->needD[1] = pvl->needD[2] = AIR_FALSE; pvl->nin = nin; --- 70,74 ---- pvl->verbose = gageDefVerbose; pvl->kind = kind; ! GAGE_QUERY_RESET(pvl->query); pvl->needD[0] = pvl->needD[1] = pvl->needD[2] = AIR_FALSE; pvl->nin = nin; *************** *** 77,90 **** pvl->padInfo = NULL; pvl->npad = NULL; ! for (i=0; i<GAGE_PVL_FLAG_NUM; i++) { ! pvl->flag[i] = AIR_FALSE; } pvl->iv3 = pvl->iv2 = pvl->iv1 = NULL; pvl->lup = nrrdLOOKUP[nin->type]; ! pvl->ans = (gage_t *)calloc(kind->totalAnsLen, sizeof(gage_t)); ! if (!pvl->ans) { ! sprintf(err, "%s: couldn't alloc answer array", me); biffAdd(GAGE, err); return NULL; } pvl->flag[gagePvlFlagVolume] = AIR_TRUE; --- 77,95 ---- pvl->padInfo = NULL; pvl->npad = NULL; ! for (ii=0; ii<GAGE_PVL_FLAG_NUM; ii++) { ! pvl->flag[ii] = AIR_FALSE; } pvl->iv3 = pvl->iv2 = pvl->iv1 = NULL; pvl->lup = nrrdLOOKUP[nin->type]; ! pvl->answer = (gage_t *)calloc(gageKindTotalAnswerLength(kind), ! sizeof(gage_t)); ! pvl->directAnswer = (gage_t **)calloc(kind->itemMax+1, sizeof(gage_t*)); ! if (!(pvl->answer && pvl->directAnswer)) { ! sprintf(err, "%s: couldn't alloc answer and directAnswer arrays", me); biffAdd(GAGE, err); return NULL; } + for (ii=0; ii<=kind->itemMax; ii++) { + pvl->directAnswer[ii] = pvl->answer + gageKindAnswerOffset(kind, ii); + } pvl->flag[gagePvlFlagVolume] = AIR_TRUE; *************** *** 102,105 **** --- 107,111 ---- char me[]="gagePerVolumeCopy", err[AIR_STRLEN_MED]; gagePerVolume *nvl; + int ii; nvl = (gagePerVolume *)calloc(1, sizeof(gagePerVolume)); *************** *** 122,130 **** nvl->iv2 = (gage_t *)calloc(fd*fd*nvl->kind->valLen, sizeof(gage_t)); nvl->iv1 = (gage_t *)calloc(fd*nvl->kind->valLen, sizeof(gage_t)); ! nvl->ans = (gage_t *)calloc(nvl->kind->totalAnsLen, sizeof(gage_t)); ! if (!( nvl->iv3 && nvl->iv2 && nvl->iv1 && nvl->ans )) { sprintf(err, "%s: couldn't allocate all caches", me); biffAdd(GAGE, err); return NULL; } return nvl; --- 128,143 ---- nvl->iv2 = (gage_t *)calloc(fd*fd*nvl->kind->valLen, sizeof(gage_t)); nvl->iv1 = (gage_t *)calloc(fd*nvl->kind->valLen, sizeof(gage_t)); ! nvl->answer = (gage_t *)calloc(gageKindTotalAnswerLength(nvl->kind), ! sizeof(gage_t)); ! nvl->directAnswer = (gage_t **)calloc(nvl->kind->itemMax+1, ! sizeof(gage_t*)); ! if (!( nvl->iv3 && nvl->iv2 && nvl->iv1 ! && nvl->answer && nvl->directAnswer )) { sprintf(err, "%s: couldn't allocate all caches", me); biffAdd(GAGE, err); return NULL; } + for (ii=0; ii<=pvl->kind->itemMax; ii++) { + nvl->directAnswer[ii] = nvl->answer + gageKindAnswerOffset(pvl->kind, ii); + } return nvl; *************** *** 148,152 **** pvl->nixer(pvl->npad, pvl->kind, pvl); } ! AIR_FREE(pvl->ans); AIR_FREE(pvl); return NULL; --- 161,166 ---- pvl->nixer(pvl->npad, pvl->kind, pvl); } ! AIR_FREE(pvl->answer); ! AIR_FREE(pvl->directAnswer); AIR_FREE(pvl); return NULL; *************** *** 183,194 **** ** way of getting a pointer to a specific answer in a pervolume's ans array ** - ** Basically just a wrapper around GAGE_ANSWER_POINTER with error checking */ gage_t * ! gageAnswerPointer (gageContext *ctx, gagePerVolume *pvl, int measure) { gage_t *ret; ! if (pvl && !airEnumValCheck(pvl->kind->enm, measure)) { ! ret = GAGE_ANSWER_POINTER(pvl, measure); } else { ret = NULL; --- 197,207 ---- ** way of getting a pointer to a specific answer in a pervolume's ans array ** */ gage_t * ! gageAnswerPointer (gageContext *ctx, gagePerVolume *pvl, int item) { gage_t *ret; ! if (pvl && !airEnumValCheck(pvl->kind->enm, item)) { ! ret = pvl->answer + gageKindAnswerOffset(pvl->kind, item); } else { ret = NULL; *************** *** 197,200 **** --- 210,232 ---- } + int + gageQueryReset(gageContext *ctx, gagePerVolume *pvl) { + char me[]="gageQueryReset", err[AIR_STRLEN_MED]; + + if (!( pvl )) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(GAGE, err); return 1; + } + if (pvl->thisIsACopy) { + sprintf(err, "%s: can't operate on a pervolume copy", me); + biffAdd(GAGE, err); return 1; + } + + GAGE_QUERY_RESET(pvl->query); + + return 0; + } + + /* ******** gageQuerySet() *************** *** 204,212 **** ** ** Sets: pvl->query */ int ! gageQuerySet (gageContext *ctx, gagePerVolume *pvl, unsigned int query) { char me[]="gageQuerySet", err[AIR_STRLEN_MED]; ! unsigned int mask, lastq, q; if (!( pvl )) { --- 236,248 ---- ** ** Sets: pvl->query + ** + ** the gageContext is not actually used here, but I'm cautiously + ** including it in case its used in the future. */ int ! gageQuerySet (gageContext *ctx, gagePerVolume *pvl, gageQuery query) { char me[]="gageQuerySet", err[AIR_STRLEN_MED]; ! gageQuery lastQuery; ! int pi, ii; if (!( pvl )) { *************** *** 218,227 **** biffAdd(GAGE, err); return 1; } ! mask = (1U << (pvl->kind->queryMax+1)) - 1; ! if (query != (query & mask)) { ! sprintf(err, "%s: invalid bits set in query", me); ! biffAdd(GAGE, err); return 1; ! } ! pvl->query = query; if (pvl->verbose) { fprintf(stderr, "%s: original ", me); --- 254,258 ---- biffAdd(GAGE, err); return 1; } ! GAGE_QUERY_COPY(pvl->query, query); if (pvl->verbose) { fprintf(stderr, "%s: original ", me); *************** *** 230,241 **** /* recursive expansion of prerequisites */ do { ! lastq = pvl->query; ! q = pvl->kind->queryMax+1; do { ! q--; ! if ((1<<q) & pvl->query) ! pvl->query |= pvl->kind->queryPrereq[q]; ! } while (q); ! } while (pvl->query != lastq); if (pvl->verbose) { fprintf(stderr, "%s: expanded ", me); --- 261,277 ---- /* recursive expansion of prerequisites */ do { ! GAGE_QUERY_COPY(lastQuery, pvl->query); ! ii = pvl->kind->itemMax+1; do { ! ii--; ! if (GAGE_QUERY_ITEM_TEST(pvl->query, ii)) { ! for (pi=0; pi<GAGE_ITEM_PREREQ_NUM; pi++) { ! if (-1 != pvl->kind->table[ii].prereq[pi]) { ! GAGE_QUERY_ITEM_ON(pvl->query, pvl->kind->table[ii].prereq[pi]); ! } ! } ! } ! } while (ii); ! } while (!GAGE_QUERY_EQUAL(pvl->query, lastQuery)); if (pvl->verbose) { fprintf(stderr, "%s: expanded ", me); *************** *** 246,247 **** --- 282,306 ---- return 0; } + + int + gageQueryItemOn(gageContext *ctx, gagePerVolume *pvl, int item) { + char me[]="gageQueryItemOn", err[AIR_STRLEN_MED]; + + if (!( pvl )) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(GAGE, err); return 1; + } + if (pvl->thisIsACopy) { + sprintf(err, "%s: can't operate on a pervolume copy", me); + biffAdd(GAGE, err); return 1; + } + + GAGE_QUERY_ITEM_ON(pvl->query, item); + if (gageQuerySet(ctx, pvl, pvl->query)) { + sprintf(err, "%s: trouble", me); + biffAdd(GAGE, err); return 1; + } + + return 0; + } + Index: scl.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/scl.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** scl.c 7 Jan 2004 15:34:29 -0000 1.29 --- scl.c 13 Feb 2004 22:56:15 -0000 1.30 *************** *** 22,156 **** /* ! gageSclUnknown=-1, -1: nobody knows ! gageSclValue, * 0: "v", data value: *GT * ! gageSclGradVec, * 1: "grad", gradient vector, un-normalized: GT[3] * ! gageSclGradMag, * 2: "gm", gradient magnitude: *GT * ! gageSclNormal, * 3: "n", gradient vector, normalized: GT[3] * ! gageSclNPerp, * 4: "np", projection onto tangent plane: GT[9] * ! gageSclHessian, * 5: "h", Hessian: GT[9] (column-order) * ! gageSclLaplacian, * 6: "l", Laplacian: Dxx + Dyy + Dzz: *GT * ! gageSclHessEval, * 7: "heval", Hessian's eigenvalues: GT[3] * ! gageSclHessEvec, * 8: "hevec", Hessian's eigenvectors: GT[9] * ! gageScl2ndDD, * 9: "2d", 2nd dir.deriv. along gradient: *GT * ! gageSclGeomTens, * 10: "gten", sym. matx w/ evals 0,K1,K2 and evecs grad, ! curvature directions: GT[9] * ! gageSclK1, * 11: "k1", 1st principle curvature: *GT * ! gageSclK2, * 12: "k2", 2nd principle curvature (k2 <= k1): *GT * ! gageSclCurvedness, * 13: "cv", L2 norm of K1, K2 (not Koen.'s "C"): *GT * ! gageSclShapeTrace, * 14, "st", (K1+K2)/Curvedness: *GT * ! gageSclShapeIndex, * 15: "si", Koen.'s shape index, ("S"): *GT * ! gageSclMeanCurv, * 16: "mc", mean curvature (K1 + K2)/2: *GT * ! gageSclGaussCurv, * 17: "gc", gaussian curvature K1*K2: *GT * ! gageSclCurvDir, * 18: "cdir", principle curvature directions: GT[6] * ! gageSclFlowlineCurv,* 19: "nc", curvature of normal streamline: *GT * ! 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ! */ ! ! /* ! ******** gageSclAnsLength[] ! ** ! ** the number of gage_t used for each answer ! */ ! int ! gageSclAnsLength[GAGE_SCL_MAX+1] = { ! 1, 3, 1, 3, 9, 9, 1, 3, 9, 1, 9, 1, 1, 1, 1, 1, 1, 1, 6, 1 ! }; ! ! /* ! ******** gageSclAnsOffset[] ! ** ! ** the index into the answer array of the first element of the answer ! */ ! int ! gageSclAnsOffset[GAGE_SCL_MAX+1] = { ! 0, 1, 4, 5, 8, 17, 26, 27, 30, 39, 40, 49, 50, 51, 52, 53, 54, 55, 56, 62 ! /* --> 63 == GAGE_SCL_TOTAL_ANS_LENGTH */ ! }; ! ! /* ! ** _gageSclNeedDeriv[] ** ! ** each value is a BIT FLAG representing the different value/derivatives ! ** that are needed to calculate the quantity. ** ! ** 1: need value interpolation reconstruction (as with k00) ! ** 2: need first derivatives (as with k11) ! ** 4: need second derivatives (as with k22) ! */ ! int ! _gageSclNeedDeriv[GAGE_SCL_MAX+1] = { ! 1, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 ! }; ! ! /* ! ** _gageSclPrereq[] ! ** ! ** this records the measurements which are needed as ingredients for any ! ** given measurement, but it is not necessarily the recursive expansion of ! ** that requirement (that role is performed by gageQuerySet()) */ ! unsigned int ! _gageSclPrereq[GAGE_SCL_MAX+1] = { ! /* 0: gageSclValue */ ! 0, ! ! /* 1: gageSclGradVec */ ! 0, ! ! /* 2: gageSclGradMag */ ! (1<<gageSclGradVec), ! ! /* 3: gageSclNormal */ ! (1<<gageSclGradVec) | (1<<gageSclGradMag), ! ! /* 3: gageSclNPerp */ ! (1<<gageSclNormal), ! ! /* 5: gageSclHessian */ ! 0, ! ! /* 6: gageSclLaplacian */ ! (1<<gageSclHessian), /* not really true, but this is simpler */ ! ! /* 7: gageSclHessEval */ ! (1<<gageSclHessian), ! ! /* 8: gageSclHessEvec */ ! (1<<gageSclHessian) | (1<<gageSclHessEval), ! ! /* 9: gageScl2ndDD */ ! (1<<gageSclHessian) | (1<<gageSclNormal), ! ! /* 10: gageSclGeomTens */ ! (1<<gageSclHessian) | (1<<gageSclNPerp) | (1<<gageSclGradMag), ! ! /* 11: gageSclK1 */ ! (1<<gageSclCurvedness) | (1<<gageSclShapeTrace), ! ! /* 12: gageSclK2 */ ! (1<<gageSclCurvedness) | (1<<gageSclShapeTrace), ! ! /* 13: gageSclCurvedness */ ! (1<<gageSclGeomTens), ! ! /* 14: gageSclShapeTrace */ ! (1<<gageSclGeomTens), ! ! /* 15: gageSclShapeIndex */ ! (1<<gageSclK1) | (1<<gageSclK2), ! ! /* 16: gageSclMeanCurv */ ! (1<<gageSclK1) | (1<<gageSclK2), ! ! /* 17: gageSclGaussCurv */ ! (1<<gageSclK1) | (1<<gageSclK2), ! ! /* 18: gageSclCurvDir */ ! (1<<gageSclGeomTens) | (1<<gageSclK1) | (1<<gageSclK2), ! ! /* 19: gageSclFlowlineCurv */ ! /* this is because of how answer code uses sHess, nPerp, nProj */ ! (1<<gageSclGeomTens) ! }; --- 22,65 ---- /* ! ** _gageSclTable ** ! ** the static array of item information for the scalar kind. ** ! ** General notes about setting these things up: ! ** - Yes, you'll need more than 80 columns of display ! ** - You do need to explicitily initialize all the prerequisite elements, ! ** because the compiler will initialize them to zero (which is a valid ! ** item value) */ ! gageItemEntry ! _gageSclTable[GAGE_SCL_ITEM_MAX+1] = { ! /* enum value len,deriv, prereqs, parent item, index*/ ! {gageSclValue, 1, 0, {-1, -1, -1, -1, -1}, -1, -1}, ! {gageSclGradVec, 3, 1, {-1, -1, -1, -1, -1}, -1, -1}, ! {gageSclGradMag, 1, 1, {gageSclGradVec, -1, -1, -1, -1}, -1, -1}, ! {gageSclNormal, 3, 1, {gageSclGradVec, gageSclGradMag, -1, -1, -1}, -1, -1}, ! {gageSclNPerp, 9, 1, {gageSclNormal, -1, -1, -1, -1}, -1, -1}, ! {gageSclHessian, 9, 2, {gageSclHessian, -1, -1, -1, -1}, -1, -1}, ! {gageSclLaplacian, 1, 2, {gageSclHessian, -1, -1, -1, -1}, -1, -1}, ! {gageSclHessEval, 3, 2, {gageSclHessian, -1, -1, -1, -1}, -1, -1}, ! {gageSclHessEval0, 1, 2, {gageSclHessEval, -1, -1, -1, -1}, gageSclHessEval, 0}, ! {gageSclHessEval1, 1, 2, {gageSclHessEval, -1, -1, -1, -1}, gageSclHessEval, 1}, ! {gageSclHessEval2, 1, 2, {gageSclHessEval, -1, -1, -1, -1}, gageSclHessEval, 2}, ! {gageSclHessEvec, 9, 2, {gageSclHessian, gageSclHessEval, -1, -1, -1}, -1, -1}, ! {gageSclHessEvec0, 3, 2, {gageSclHessEvec, -1, -1, -1, -1}, gageSclHessEvec, 0}, ! {gageSclHessEvec1, 3, 2, {gageSclHessEvec, -1, -1, -1, -1}, gageSclHessEvec, 3}, ! {gageSclHessEvec2, 3, 2, {gageSclHessEvec, -1, -1, -1, -1}, gageSclHessEvec, 6}, ! {gageScl2ndDD, 1, 2, {gageSclHessian, gageSclNormal, -1, -1, -1}, -1, -1}, ! {gageSclGeomTens, 1, 2, {gageSclHessian, gageSclNPerp, gageSclGradMag, -1, -1}, -1, -1}, ! {gageSclK1, 1, 2, {gageSclCurvedness, gageSclShapeTrace, -1, -1, -1}, -1, -1}, ! {gageSclK2, 1, 2, {gageSclCurvedness, gageSclShapeTrace, -1, -1, -1}, -1, -1}, ! {gageSclCurvedness, 1, 2, {gageSclGeomTens, -1, -1, -1, -1}, -1, -1}, ! {gageSclShapeTrace, 1, 2, {gageSclGeomTens, -1, -1, -1, -1}, -1, -1}, ! {gageSclShapeIndex, 1, 2, {gageSclK1, gageSclK2, -1, -1, -1}, -1, -1}, ! {gageSclMeanCurv, 1, 2, {gageSclK1, gageSclK2, -1, -1, -1}, -1, -1}, ! {gageSclGaussCurv, 1, 2, {gageSclK1, gageSclK2, -1, -1, -1}, -1, -1}, ! {gageSclCurvDir1, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, ! {gageSclCurvDir2, 3, 2, {gageSclGeomTens, gageSclK1, gageSclK2, -1, -1}, -1, -1}, ! {gageSclFlowlineCurv, 1, 2, {gageSclGeomTens, -1, -1, -1, -1}, -1, -1} }; *************** *** 166,170 **** --- 75,85 ---- "Laplacian", "Hessian eigenvalues", + "Hessian eigenvalue[0]", + "Hessian eigenvalue[1]", + "Hessian eigenvalue[2]", "Hessian eigenvectors", + "Hessian eigenvector[0]", + "Hessian eigenvector[1]", + "Hessian eigenvector[2]", "2nd DD along gradient", "geometry tensor", *************** *** 176,180 **** "mean curvature", "Gaussian curvature", ! "curvature directions", "flowline curvature" }; --- 91,96 ---- "mean curvature", "Gaussian curvature", ! "1st curvature direction", ! "2nd curvature direction", "flowline curvature" }; *************** *** 191,195 **** --- 107,117 ---- "Laplacian", "Hessian's eigenvalues", + "Hessian's 1st eigenvalue", + "Hessian's 2nd eigenvalue", + "Hessian's 3rd eigenvalue", "Hessian's eigenvectors", + "Hessian's 1st eigenvector", + "Hessian's 2nd eigenvector", + "Hessian's 3rd eigenvector", "2nd directional derivative along gradient", "geometry tensor", *************** *** 201,205 **** "mean curvature = (K1+K2)/2", "gaussian curvature = K1*K2", ! "curvature directions", "curvature of normal streamline" }; --- 123,128 ---- "mean curvature = (K1+K2)/2", "gaussian curvature = K1*K2", ! "1st principal curvature direction", ! "2nd principal curvature direction", "curvature of normal streamline" }; *************** *** 216,220 **** --- 139,149 ---- gageSclLaplacian, gageSclHessEval, + gageSclHessEval0, + gageSclHessEval1, + gageSclHessEval2, gageSclHessEvec, + gageSclHessEvec0, + gageSclHessEvec1, + gageSclHessEvec2, gageScl2ndDD, gageSclGeomTens, *************** *** 226,253 **** gageSclMeanCurv, gageSclGaussCurv, ! gageSclCurvDir, gageSclFlowlineCurv }; ! #define GS_V gageSclValue ! #define GS_GV gageSclGradVec ! #define GS_GM gageSclGradMag ! #define GS_N gageSclNormal ! #define GS_NP gageSclNPerp ! #define GS_H gageSclHessian ! #define GS_L gageSclLaplacian ! #define GS_HA gageSclHessEval ! #define GS_HE gageSclHessEvec ! #define GS_2D gageScl2ndDD ! #define GS_GT gageSclGeomTens ! #define GS_K1 gageSclK1 ! #define GS_K2 gageSclK2 ! #define GS_CV gageSclCurvedness ! #define GS_ST gageSclShapeTrace ! #define GS_SI gageSclShapeIndex ! #define GS_MC gageSclMeanCurv ! #define GS_GC gageSclGaussCurv ! #define GS_CD gageSclCurvDir ! #define GS_FC gageSclFlowlineCurv char --- 155,190 ---- gageSclMeanCurv, gageSclGaussCurv, ! gageSclCurvDir1, ! gageSclCurvDir2, gageSclFlowlineCurv }; ! #define GS_V gageSclValue ! #define GS_GV gageSclGradVec ! #define GS_GM gageSclGradMag ! #define GS_N gageSclNormal ! #define GS_NP gageSclNPerp ! #define GS_H gageSclHessian ! #define GS_L gageSclLaplacian ! #define GS_HA gageSclHessEval ! #define GS_HA0 gageSclHessEval0 ! #define GS_HA1 gageSclHessEval1 ! #define GS_HA2 gageSclHessEval2 ! #define GS_HE gageSclHessEvec ! #define GS_HE0 gageSclHessEvec0 ! #define GS_HE1 gageSclHessEvec1 ! #define GS_HE2 gageSclHessEvec2 ! #define GS_2D gageScl2ndDD ! #define GS_GT gageSclGeomTens ! #define GS_K1 gageSclK1 ! #define GS_K2 gageSclK2 ! #define GS_CV gageSclCurvedness ! #define GS_ST gageSclShapeTrace ! #define GS_SI gageSclShapeIndex ! #define GS_MC gageSclMeanCurv ! #define GS_GC gageSclGaussCurv ! #define GS_C1 gageSclCurvDir1 ! #define GS_C2 gageSclCurvDir2 ! #define GS_FC gageSclFlowlineCurv char *************** *** 262,266 **** --- 199,209 ---- "l", "lapl", "laplacian", "heval", "h eval", "hessian eval", "hessian eigenvalues", + "heval0", + "heval1", + "heval2", "hevec", "h evec", "hessian evec", "hessian eigenvectors", + "hevec0", + "hevec1", + "hevec2", "2d", "2dd", "2nddd", "2nd", "2nd dd", "2nd dd along gradient", "gten", "geoten", "geomten", "geometry tensor", *************** *** 272,276 **** "mc", "mcurv", "meancurv", "mean curvature", "gc", "gcurv", "gausscurv", "gaussian curvature", ! "cdir", "c dir", "curvdir", "curv dir", "curvature directions", "fc", "flowlinecurv", "flowline curv", "flowline curvature", "" --- 215,220 ---- "mc", "mcurv", "meancurv", "mean curvature", "gc", "gcurv", "gausscurv", "gaussian curvature", ! "cdir1", "c dir1", "curvdir1", "curv dir1", "curvature direction 1", ! "cdir2", "c dir2", "curvdir2", "curv dir2", "curvature direction 2", "fc", "flowlinecurv", "flowline curv", "flowline curvature", "" *************** *** 287,291 **** --- 231,241 ---- GS_L, GS_L, GS_L, GS_HA, GS_HA, GS_HA, GS_HA, + GS_HA0, + GS_HA1, + GS_HA2, GS_HE, GS_HE, GS_HE, GS_HE, + GS_HE0, + GS_HE1, + GS_HE2, GS_2D, GS_2D, GS_2D, GS_2D, GS_2D, GS_2D, GS_GT, GS_GT, GS_GT, GS_GT, *************** *** 297,301 **** GS_MC, GS_MC, GS_MC, GS_MC, GS_GC, GS_GC, GS_GC, GS_GC, ! GS_CD, GS_CD, GS_CD, GS_CD, GS_CD, GS_FC, GS_FC, GS_FC, GS_FC }; --- 247,252 ---- GS_MC, GS_MC, GS_MC, GS_MC, GS_GC, GS_GC, GS_GC, GS_GC, ! GS_C1, GS_C1, GS_C1, GS_C1, GS_C1, ! GS_C2, GS_C2, GS_C2, GS_C2, GS_C2, GS_FC, GS_FC, GS_FC, GS_FC }; *************** *** 304,308 **** _gageScl = { "gageScl", ! GAGE_SCL_MAX+1, _gageSclStr, _gageSclVal, _gageSclDesc, --- 255,259 ---- _gageScl = { "gageScl", ! GAGE_SCL_ITEM_MAX+1, _gageSclStr, _gageSclVal, _gageSclDesc, *************** *** 319,328 **** 0, 1, ! GAGE_SCL_MAX, ! gageSclAnsLength, ! gageSclAnsOffset, ! GAGE_SCL_TOTAL_ANS_LENGTH, ! _gageSclNeedDeriv, ! _gageSclPrereq, _gageSclIv3Print, _gageSclFilter, --- 270,275 ---- 0, 1, ! GAGE_SCL_ITEM_MAX, ! _gageSclTable, _gageSclIv3Print, _gageSclFilter, *************** *** 331,333 **** gageKind * gageKindScl = &_gageKindScl; - --- 278,279 ---- Index: sclanswer.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/sclanswer.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sclanswer.c 7 Jan 2004 15:34:29 -0000 1.14 --- sclanswer.c 13 Feb 2004 22:56:15 -0000 1.15 *************** *** 24,55 **** _gageSclAnswer (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageSclAnswer"; - unsigned int query; gage_t *ans, gmag=0, *hess, *norm, *gvec, *gten, *k1, *k2, sHess[9], curv=0; double tmpMat[9], tmpVec[3], hevec[9], heval[3]; - int *offset; gage_t len, gp1[3], gp2[3], *nPerp, nProj[9], ncTen[9]; double T, N, D; ! query = pvl->query; ! ans = pvl->ans; /* convenience pointers for work below */ ! offset = gageKindScl->ansOffset; ! hess = ans + offset[gageSclHessian]; ! gvec = ans + offset[gageSclGradVec]; ! norm = ans + offset[gageSclNormal]; ! nPerp = ans + offset[gageSclNPerp]; ! gten = ans + offset[gageSclGeomTens]; ! k1 = ans + offset[gageSclK1]; ! k2 = ans + offset[gageSclK2]; ! if (1 & (query >> gageSclValue)) { /* done if doV */ if (ctx->verbose) { fprintf(stderr, "%s: val = % 15.7f\n", me, ! (double)(ans[offset[gageSclValue]])); } } ! if (1 & (query >> gageSclGradVec)) { /* done if doD1 */ if (ctx->verbose) { --- 24,51 ---- _gageSclAnswer (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageSclAnswer"; gage_t *ans, gmag=0, *hess, *norm, *gvec, *gten, *k1, *k2, sHess[9], curv=0; double tmpMat[9], tmpVec[3], hevec[9], heval[3]; gage_t len, gp1[3], gp2[3], *nPerp, nProj[9], ncTen[9]; double T, N, D; ! ans = pvl->answer; /* convenience pointers for work below */ ! hess = pvl->directAnswer[gageSclHessian]; ! gvec = pvl->directAnswer[gageSclGradVec]; ! norm = pvl->directAnswer[gageSclNormal]; ! nPerp = pvl->directAnswer[gageSclNPerp]; ! gten = pvl->directAnswer[gageSclGeomTens]; ! k1 = pvl->directAnswer[gageSclK1]; ! k2 = pvl->directAnswer[gageSclK2]; ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclValue)) { /* done if doV */ if (ctx->verbose) { fprintf(stderr, "%s: val = % 15.7f\n", me, ! (double)(pvl->directAnswer[gageSclValue][0])); } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclGradVec)) { /* done if doD1 */ if (ctx->verbose) { *************** *** 58,69 **** } } ! if (1 & (query >> gageSclGradMag)) { /* this is the true value of gradient magnitude */ ! gmag = ans[offset[gageSclGradMag]] = sqrt(ELL_3V_DOT(gvec, gvec)); } /* NB: it would seem that gageParmGradMagMin is completely ignored ... */ ! if (1 & (query >> gageSclNormal)) { if (gmag) { ELL_3V_SCALE(norm, 1.0/gmag, gvec); --- 54,65 ---- } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclGradMag)) { /* this is the true value of gradient magnitude */ ! gmag = pvl->directAnswer[gageSclGradMag][0] = sqrt(ELL_3V_DOT(gvec, gvec)); } /* NB: it would seem that gageParmGradMagMin is completely ignored ... */ ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclNormal)) { if (gmag) { ELL_3V_SCALE(norm, 1.0/gmag, gvec); *************** *** 76,80 **** } } ! if (1 & (query >> gageSclNPerp)) { /* nPerp = I - outer(norm, norm) */ /* NB: this sets both nPerp and nProj */ --- 72,76 ---- } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclNPerp)) { /* nPerp = I - outer(norm, norm) */ /* NB: this sets both nPerp and nProj */ *************** *** 85,89 **** nPerp[8] += 1; } ! if (1 & (query >> gageSclHessian)) { /* done if doD2 */ if (ctx->verbose) { --- 81,85 ---- nPerp[8] += 1; } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclHessian)) { /* done if doD2 */ if (ctx->verbose) { *************** *** 92,103 **** } } ! if (1 & (query >> gageSclLaplacian)) { ! ans[offset[gageSclLaplacian]] = hess[0] + hess[4] + hess[8]; if (ctx->verbose) { fprintf(stderr, "%s: lapl = %g + %g + %g = %g\n", me, ! hess[0], hess[4], hess[8], ans[offset[gageSclLaplacian]]); } } ! if (1 & (query >> gageSclHessEval)) { ELL_3M_COPY(tmpMat, hess); /* HEY: look at the return value for root multiplicity? */ --- 88,100 ---- } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclLaplacian)) { ! pvl->directAnswer[gageSclLaplacian][0] = hess[0] + hess[4] + hess[8]; if (ctx->verbose) { fprintf(stderr, "%s: lapl = %g + %g + %g = %g\n", me, ! hess[0], hess[4], hess[8], ! pvl->directAnswer[gageSclLaplacian][0]); } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclHessEval)) { ELL_3M_COPY(tmpMat, hess); /* HEY: look at the return value for root multiplicity? */ *************** *** 105,118 **** mismatch between double and gage_t */ ell_3m_eigensolve_d(heval, hevec, tmpMat, AIR_TRUE); ! ELL_3V_COPY(ans+offset[gageSclHessEval], heval); } ! if (1 & (query >> gageSclHessEvec)) { ! ELL_3M_COPY(ans+offset[gageSclHessEvec], hevec); } ! if (1 & (query >> gageScl2ndDD)) { ELL_3MV_MUL(tmpVec, hess, norm); ! ans[offset[gageScl2ndDD]] = ELL_3V_DOT(norm, tmpVec); } ! if (1 & (query >> gageSclGeomTens)) { if (gmag > ctx->parm.gradMagCurvMin) { /* parm.curvNormalSide applied here to determine the sense of the --- 102,115 ---- mismatch between double and gage_t */ ell_3m_eigensolve_d(heval, hevec, tmpMat, AIR_TRUE); ! ELL_3V_COPY(pvl->directAnswer[gageSclHessEval], heval); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclHessEvec)) { ! ELL_3M_COPY(pvl->directAnswer[gageSclHessEvec], hevec); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageScl2ndDD)) { ELL_3MV_MUL(tmpVec, hess, norm); ! pvl->directAnswer[gageScl2ndDD][0] = ELL_3V_DOT(norm, tmpVec); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclGeomTens)) { if (gmag > ctx->parm.gradMagCurvMin) { /* parm.curvNormalSide applied here to determine the sense of the *************** *** 144,157 **** } } ! if (1 && (query >> gageSclCurvedness)) { ! curv = ans[offset[gageSclCurvedness]] = ELL_3M_FROB(gten); } ! if (1 && (query >> gageSclShapeTrace)) { ! ans[offset[gageSclShapeTrace]] = (curv ! ? ELL_3M_TRACE(gten)/curv ! : 0); } ! if ( (1 && (query >> gageSclK1)) || ! (1 && (query >> gageSclK2)) ){ T = ELL_3M_TRACE(gten); N = curv; --- 141,154 ---- } } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclCurvedness)) { ! curv = pvl->directAnswer[gageSclCurvedness][0] = ELL_3M_FROB(gten); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclShapeTrace)) { ! pvl->directAnswer[gageSclShapeTrace][0] = (curv ! ? ELL_3M_TRACE(gten)/curv ! : 0); } ! if ( (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclK1)) || ! (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclK2)) ){ T = ELL_3M_TRACE(gten); N = curv; *************** *** 170,183 **** k2[0] = 0.5*(T - D); } ! if (1 && (query >> gageSclMeanCurv)) { ! ans[offset[gageSclMeanCurv]] = (*k1 + *k2)/2; } ! if (1 && (query >> gageSclGaussCurv)) { ! ans[offset[gageSclGaussCurv]] = (*k1)*(*k2); } ! if (1 && (query >> gageSclShapeIndex)) { ! ans[offset[gageSclShapeIndex]] = -(2/M_PI)*atan2(*k1 + *k2, *k1 - *k2); } ! if (1 & (query >> gageSclCurvDir)) { /* HEY: this only works when K1, K2, 0 are all well mutually distinct, since these are the eigenvalues of the geometry tensor, and this --- 167,181 ---- k2[0] = 0.5*(T - D); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclMeanCurv)) { ! pvl->directAnswer[gageSclMeanCurv][0] = (*k1 + *k2)/2; } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclGaussCurv)) { ! pvl->directAnswer[gageSclGaussCurv][0] = (*k1)*(*k2); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclShapeIndex)) { ! pvl->directAnswer[gageSclShapeIndex][0] = ! -(2/M_PI)*atan2(*k1 + *k2, *k1 - *k2); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclCurvDir1)) { /* HEY: this only works when K1, K2, 0 are all well mutually distinct, since these are the eigenvalues of the geometry tensor, and this *************** *** 186,195 **** ELL_3M_DIAG_SET(tmpMat, gten[0] - *k1, gten[4]- *k1, gten[8] - *k1); ell_3m_1d_nullspace_d(tmpVec, tmpMat); ! ELL_3V_COPY(ans+offset[gageSclCurvDir]+0, tmpVec); ELL_3M_DIAG_SET(tmpMat, gten[0] - *k2, gten[4] - *k2, gten[8] - *k2); ell_3m_1d_nullspace_d(tmpVec, tmpMat); ! ELL_3V_COPY(ans+offset[gageSclCurvDir]+3, tmpVec); } ! if (1 & (query >> gageSclFlowlineCurv)) { if (gmag >= ctx->parm.gradMagCurvMin) { /* because of the gageSclGeomTens prerequisite, sHess, nPerp, and --- 184,199 ---- ELL_3M_DIAG_SET(tmpMat, gten[0] - *k1, gten[4]- *k1, gten[8] - *k1); ell_3m_1d_nullspace_d(tmpVec, tmpMat); ! ELL_3V_COPY(pvl->directAnswer[gageSclCurvDir1], tmpVec); ! } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclCurvDir2)) { ! /* HEY: this only works when K1, K2, 0 are all well mutually distinct, ! since these are the eigenvalues of the geometry tensor, and this ! code assumes that the eigenspaces are all one-dimensional */ ! ELL_3M_COPY(tmpMat, gten); ELL_3M_DIAG_SET(tmpMat, gten[0] - *k2, gten[4] - *k2, gten[8] - *k2); ell_3m_1d_nullspace_d(tmpVec, tmpMat); ! ELL_3V_COPY(pvl->directAnswer[gageSclCurvDir2], tmpVec); } ! if (GAGE_QUERY_ITEM_TEST(pvl->query, gageSclFlowlineCurv)) { if (gmag >= ctx->parm.gradMagCurvMin) { /* because of the gageSclGeomTens prerequisite, sHess, nPerp, and *************** *** 201,205 **** ELL_3M_ZERO_SET(ncTen); } ! ans[offset[gageSclFlowlineCurv]] = sqrt(ELL_3M_FROB(ncTen)); } return; --- 205,209 ---- ELL_3M_ZERO_SET(ncTen); } ! pvl->directAnswer[gageSclFlowlineCurv][0] = sqrt(ELL_3M_FROB(ncTen)); } return; Index: sclfilter.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/sclfilter.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sclfilter.c 7 Jan 2004 15:34:29 -0000 1.14 --- sclfilter.c 13 Feb 2004 22:56:15 -0000 1.15 *************** *** 397,406 **** _gageSclFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageSclFilter"; ! int fd, *offset; ! gage_t *fw00, *fw11, *fw22, *ans; fd = GAGE_FD(ctx); - offset = gageKindScl->ansOffset; - ans = pvl->ans; if (!ctx->parm.k3pack) { fprintf(stderr, "!%s: sorry, 6-pack filtering not implemented\n", me); --- 397,404 ---- _gageSclFilter (gageContext *ctx, gagePerVolume *pvl) { char me[]="_gageSclFilter"; ! int fd; ! gage_t *fw00, *fw11, *fw22; fd = GAGE_FD(ctx); if (!ctx->parm.k3pack) { fprintf(stderr, "!%s: sorry, 6-pack filtering not implemented\n", me); *************** *** 415,421 **** gageScl3PFilter2(pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! ans + offset[gageSclValue], ! ans + offset[gageSclGradVec], ! ans + offset[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; --- 413,419 ---- gageScl3PFilter2(pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! pvl->directAnswer[gageSclValue], ! pvl->directAnswer[gageSclGradVec], ! pvl->directAnswer[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; *************** *** 423,429 **** gageScl3PFilter4(pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! ans + offset[gageSclValue], ! ans + offset[gageSclGradVec], ! ans + offset[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; --- 421,427 ---- gageScl3PFilter4(pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! pvl->directAnswer[gageSclValue], ! pvl->directAnswer[gageSclGradVec], ! pvl->directAnswer[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; *************** *** 432,438 **** pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! ans + offset[gageSclValue], ! ans + offset[gageSclGradVec], ! ans + offset[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; --- 430,436 ---- pvl->iv3, pvl->iv2, pvl->iv1, fw00, fw11, fw22, ! pvl->directAnswer[gageSclValue], ! pvl->directAnswer[gageSclGradVec], ! pvl->directAnswer[gageSclHessian], pvl->needD[0], pvl->needD[1], pvl->needD[2]); break; Index: st.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/st.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** st.c 7 Jan 2004 15:34:29 -0000 1.5 --- st.c 13 Feb 2004 22:56:15 -0000 1.6 *************** *** 89,92 **** --- 89,93 ---- _ixi, _iyi, _izi, ixi, iyi, izi, wi, *coordCache; gageContext *ctx; + gageQuery query; gagePerVolume *pvl; airArray *mop; *************** *** 141,145 **** if (!E) E |= gageKernelSet(ctx, gageKernel00, gk0->kernel, gk0->parm); if (!E) E |= gageKernelSet(ctx, gageKernel11, gk1->kernel, gk1->parm); ! if (!E) E |= gageQuerySet(ctx, pvl, 1 << gageSclGradVec); if (!E) E |= gageUpdate(ctx); if (E) { --- 142,148 ---- if (!E) E |= gageKernelSet(ctx, gageKernel00, gk0->kernel, gk0->parm); if (!E) E |= gageKernelSet(ctx, gageKernel11, gk1->kernel, gk1->parm); ! if (!E) GAGE_QUERY_RESET(query); ! if (!E) GAGE_QUERY_ITEM_ON(query, gageSclGradVec); ! if (!E) E |= gageQuerySet(ctx, pvl, query); if (!E) E |= gageUpdate(ctx); if (E) { Index: update.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/update.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** update.c 7 Jan 2004 15:34:29 -0000 1.11 --- update.c 13 Feb 2004 22:56:15 -0000 1.12 *************** *** 55,59 **** char me[]="_gagePvlNeedDUpdate"; gagePerVolume *pvl; ! int i, q, d, needD[3]; if (ctx->verbose) fprintf(stderr, "%s: hello\n", me); --- 55,59 ---- char me[]="_gagePvlNeedDUpdate"; gagePerVolume *pvl; ! int i, q, needD[3]; if (ctx->verbose) fprintf(stderr, "%s: hello\n", me); *************** *** 62,72 **** if (pvl->flag[gagePvlFlagQuery]) { ELL_3V_SET(needD, 0, 0, 0); ! q = pvl->kind->queryMax+1; do { q--; ! if (pvl->query & (1 << q)) { ! for (d=0; d<=2; d++) { ! needD[d] |= (pvl->kind->needDeriv[q] & (1 << d)); ! } } } while (q); --- 62,70 ---- if (pvl->flag[gagePvlFlagQuery]) { ELL_3V_SET(needD, 0, 0, 0); ! q = pvl->kind->itemMax+1; do { q--; ! if (GAGE_QUERY_ITEM_TEST(pvl->query, q)) { ! needD[pvl->kind->table[q].needDeriv] = 1; } } while (q); Index: vecGage.c =================================================================== RCS file: /cvsroot/teem/teem/src/gage/vecGage.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** vecGage.c 7 Jan 2004 15:34:29 -0000 1.13 --- vecGage.c 13 Feb 2004 22:56:15 -0000 1.14 *************** *** 21,124 **** #include "privateGage.h" ! /* ! gageVecVector, 0: "v", component-wise-intrpolated (CWI) vec: GT[3] ! gageVecLength, 1: "l", length of CWI vector: *GT ! gageVecNormalized, 2: "n", normalized CWI vector: GT[3] ! gageVecJacobian, 3: "j", component-wise Jacobian: GT[9] ! gageVecDivergence, 4: "d", divergence (based on Jacobian): *GT ! gageVecCurl, 5: "c", curl (based on Jacobian): GT[3] ! gageVecGradient0, 6: "g1", gradient of 1st component of vector: GT[3] ! gageVecGradient1, 7: "g2", gradient of 2nd component of vector: GT[3] ! gageVecGradient2, 8: "g3", gradient of 3rd component of vector: GT[3] ! gageVecMultiGrad, 9: "mg", sum of outer products of gradients: GT[9] ! gageVecMGFrob, 10: "mgfrob", frob norm of multi-gradient: *GT ! gageVecMGEval, 11: "mgeval", eigenvalues of multi-gradient: GT[3] ! gageVecMGEvec, 12: "mgevec", ... [truncated message content] |
|
From: <ik...@us...> - 2004-02-13 18:52:47
|
Update of /cvsroot/teem/teem/src/air In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11392 Modified Files: miscAir.c Log Message: hopefully fixed problem with _setmode Index: miscAir.c =================================================================== RCS file: /cvsroot/teem/teem/src/air/miscAir.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** miscAir.c 7 Jan 2004 15:34:27 -0000 1.20 --- miscAir.c 13 Feb 2004 18:46:51 -0000 1.21 *************** *** 23,26 **** --- 23,27 ---- /* timer functions */ #ifdef _WIN32 + #include <io.h> #include <fcntl.h> #include <time.h> |
|
From: <kin...@us...> - 2004-02-13 03:46:22
|
Update of /cvsroot/teem/teem/src/air In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23564/air Modified Files: enum.c air.h Log Message: addressed Windows warnings from NrrdIO Index: enum.c =================================================================== RCS file: /cvsroot/teem/teem/src/air/enum.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** enum.c 7 Jan 2004 15:34:27 -0000 1.6 --- enum.c 13 Feb 2004 03:40:58 -0000 1.7 *************** *** 143,147 **** airEnumFmtDesc(airEnum *enm, int val, int canon, const char *fmt) { char *buff, *_ident, *desc, ident[AIR_STRLEN_SMALL]; ! int i, len; if (!(enm && enm->desc && fmt)) { --- 143,148 ---- airEnumFmtDesc(airEnum *enm, int val, int canon, const char *fmt) { char *buff, *_ident, *desc, ident[AIR_STRLEN_SMALL]; ! int i; ! size_t len; if (!(enm && enm->desc && fmt)) { Index: air.h =================================================================== RCS file: /cvsroot/teem/teem/src/air/air.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** air.h 9 Feb 2004 06:47:50 -0000 1.35 --- air.h 13 Feb 2004 03:40:58 -0000 1.36 *************** *** 33,36 **** --- 33,44 ---- #endif + /* Get rid of some warnings on VC++ */ + #ifdef _MSC_VER + #pragma warning ( disable : 4244 ) + #pragma warning ( disable : 4305 ) + #pragma warning ( disable : 4309 ) + #pragma warning ( disable : 4273 ) + #endif /* _MSC_VER */ + #if defined(_WIN32) && !defined(TEEM_STATIC) && !defined(__CYGWIN__) #define air_export __declspec(dllimport) |
|
From: <kin...@us...> - 2004-02-13 03:46:22
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23564/nrrd Modified Files: read.c keyvalue.c Log Message: addressed Windows warnings from NrrdIO Index: read.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/read.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** read.c 7 Jan 2004 15:34:30 -0000 1.86 --- read.c 13 Feb 2004 03:40:58 -0000 1.87 *************** *** 197,201 **** } numbytes = nrrdElementNumber(nrrd)*nrrdElementSize(nrrd); ! if (fseek(nio->dataFile, -numbytes, SEEK_END)) { sprintf(err, "%s: failed to fseek(dataFile, " _AIR_SIZE_T_FMT ", SEEK_END)", me, numbytes); --- 197,201 ---- } numbytes = nrrdElementNumber(nrrd)*nrrdElementSize(nrrd); ! if (fseek(nio->dataFile, -((long)numbytes), SEEK_END)) { sprintf(err, "%s: failed to fseek(dataFile, " _AIR_SIZE_T_FMT ", SEEK_END)", me, numbytes); *************** *** 333,337 **** void _nrrdSplitName (char **dirP, char **baseP, const char *name) { ! int i; if (dirP) { --- 333,337 ---- void _nrrdSplitName (char **dirP, char **baseP, const char *name) { ! char *where; if (dirP) { *************** *** 341,354 **** AIR_FREE(*baseP); } ! i = strrchr(name, '/') - name; /* we found a valid break if the last directory character is somewhere in the string except the last character */ ! if (i>=0 && i<strlen(name)-1) { if (dirP) { *dirP = airStrdup(name); ! (*dirP)[i] = 0; } if (baseP) { ! *baseP = airStrdup(name + i + 1); } } else { --- 341,354 ---- AIR_FREE(*baseP); } ! where = strrchr(name, '/'); /* we found a valid break if the last directory character is somewhere in the string except the last character */ ! if (where && airStrlen(where) > 1) { if (dirP) { *dirP = airStrdup(name); ! (*dirP)[where - name] = 0; } if (baseP) { ! *baseP = airStrdup(where + 1); } } else { Index: keyvalue.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/keyvalue.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** keyvalue.c 7 Jan 2004 15:34:30 -0000 1.6 --- keyvalue.c 13 Feb 2004 03:40:58 -0000 1.7 *************** *** 186,190 **** void _nrrdFwriteEscaped(FILE *file, const char *str) { ! int ci; for (ci=0; ci<strlen(str); ci++) { --- 186,190 ---- void _nrrdFwriteEscaped(FILE *file, const char *str) { ! size_t ci; for (ci=0; ci<strlen(str); ci++) { |
|
From: <kin...@us...> - 2004-02-13 02:53:12
|
Update of /cvsroot/teem/NrrdIO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15196 Modified Files: pre-GNUmakefile Log Message: added correctness check of TEEM_ROOT setting Index: pre-GNUmakefile =================================================================== RCS file: /cvsroot/teem/NrrdIO/pre-GNUmakefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** pre-GNUmakefile 21 Dec 2003 06:40:52 -0000 1.1.1.1 --- pre-GNUmakefile 13 Feb 2004 02:47:49 -0000 1.2 *************** *** 47,52 **** $(error Make quitting)) ### The following sources are pretty much stubs, to create the symbols, ! ### but not the functionality of different formats and the bzip2 encoding. ### As such, they are NOT copied from teem but are made for NrrdIO. ### --- 47,59 ---- $(error Make quitting)) + $(if $(wildcard $(TEEM_ROOT)/src/air/*.c),,\ + $(warning *)\ + $(warning * Environment variable TEEM_ROOT=$(TEEM_ROOT) not correctly set:)\ + $(warning * Must directory containing "src", "include", etc. of teem)\ + $(warning *)\ + $(error Make quitting)) + ### The following sources are pretty much stubs, to create the symbols, ! ### but not the functionality, of different formats and the bzip2 encoding. ### As such, they are NOT copied from teem but are made for NrrdIO. ### |
|
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); |
|
From: <kin...@us...> - 2004-02-10 09:30:07
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762 Modified Files: limn.h renderLimn.c transform.c Log Message: final debugging Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** limn.h 9 Feb 2004 22:48:01 -0000 1.46 --- limn.h 10 Feb 2004 09:26:52 -0000 1.47 *************** *** 443,446 **** --- 443,447 ---- extern int limnObjectDepthSortParts(limnObject *obj); extern int limnObjectDepthSortFaces(limnObject *obj); + extern int limnObjectFaceReverse(limnObject *obj); /* renderLimn.c */ Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** renderLimn.c 10 Feb 2004 04:42:18 -0000 1.19 --- renderLimn.c 10 Feb 2004 09:26:53 -0000 1.20 *************** *** 28,35 **** --- 28,37 ---- E = 0; if (!E) E |= limnCameraUpdate(cam); + /* fprintf(stderr, "%s: true up = %g %g %g\n", me, -cam->V[0], -cam->V[1], -cam->V[2]); fprintf(stderr, "%s: true right = %g %g %g\n", me, cam->U[0], cam->U[1], cam->U[2]); + */ if (!E) E |= limnObjectHomog(obj, limnSpaceWorld); if (!E) E |= limnObjectNormals(obj, limnSpaceWorld); Index: transform.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/transform.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** transform.c 10 Feb 2004 04:42:18 -0000 1.19 --- transform.c 10 Feb 2004 09:26:53 -0000 1.20 *************** *** 309,317 **** obj->faceSort = (int*)calloc(obj->faceNum, sizeof(int)); for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->face + faceIdx; part = obj->part + face->partIdx; face->depth = 0; for (vii=0; vii<face->sideNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; face->depth += vert->screen[2]; } --- 309,317 ---- obj->faceSort = (int*)calloc(obj->faceNum, sizeof(int)); for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->face + faceIdx; part = obj->part + face->partIdx; face->depth = 0; for (vii=0; vii<face->sideNum; vii++) { ! vert = obj->vert + part->vertIdx[face->vertIdxIdx[vii]]; face->depth += vert->screen[2]; } *************** *** 326,327 **** --- 326,360 ---- } + int + limnObjectFaceReverse(limnObject *obj) { + char me[]="limnObjectFaceReverse", err[AIR_STRLEN_MED]; + limnFace *face; int faceIdx; + limnPart *part; + int *buff, sii; + + if (!obj) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(LIMN, err); return 1; + } + buff = NULL; + for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { + face = obj->face + faceIdx; + part = obj->part + face->partIdx; + buff = (int *)calloc(face->sideNum, sizeof(int)); + if (!(buff)) { + sprintf(err, "%s: couldn't allocate %d side buffer for face %d\n", + me, face->sideNum, faceIdx); + biffAdd(LIMN, err); return 1; + } + memcpy(buff, face->vertIdxIdx, face->sideNum*sizeof(int)); + for (sii=0; sii<face->sideNum; sii++) { + face->vertIdxIdx[sii] = buff[face->sideNum-1-sii]; + } + memcpy(buff, face->edgeIdxIdx, face->sideNum*sizeof(int)); + for (sii=0; sii<face->sideNum; sii++) { + face->edgeIdxIdx[sii] = buff[face->sideNum-1-sii]; + } + free(buff); + } + return 0; + } |
|
From: <kin...@us...> - 2004-02-10 05:46:08
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26307 Modified Files: io.c Log Message: plugging memory leak Index: io.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/io.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** io.c 10 Feb 2004 04:42:18 -0000 1.11 --- io.c 10 Feb 2004 05:42:48 -0000 1.12 *************** *** 144,148 **** int *vertBase; ! airArray *vertBaseArr; if (!( obj && file )) { --- 144,148 ---- int *vertBase; ! airArray *vertBaseArr, *mop; if (!( obj && file )) { *************** *** 153,156 **** --- 153,158 ---- vertBaseArr = airArrayNew((void**)&vertBase, NULL, sizeof(int), 128); + mop = airMopNew(); + airMopAdd(mop, vertBaseArr, (airMopper)airArrayNuke, airMopAlways); got = 0; lineCount = 0; *************** *** 158,162 **** if (!airOneLine(file, line, AIR_STRLEN_LARGE)) { sprintf(err, "%s: hit EOF before getting #vert #face #edge line", me); ! biffAdd(LIMN, err); return 1; } lineCount++; --- 160,164 ---- if (!airOneLine(file, line, AIR_STRLEN_LARGE)) { sprintf(err, "%s: hit EOF before getting #vert #face #edge line", me); ! biffAdd(LIMN, err); airMopError(mop); return 1; } lineCount++; *************** *** 180,184 **** sprintf(err, "%s: (near line %d) hit EOF trying to read vert %d (of %d)", me, lineCount, vertGot, vertNum); ! biffAdd(LIMN, err); return 1; } if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { --- 182,186 ---- sprintf(err, "%s: (near line %d) hit EOF trying to read vert %d (of %d)", me, lineCount, vertGot, vertNum); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { *************** *** 188,192 **** sprintf(err, "%s: got signal to start part %d, not %d", me, idxTmp, partIdx); ! biffAdd(LIMN, err); return 1; } airArrayIncrLen(vertBaseArr, 1); --- 190,194 ---- sprintf(err, "%s: got signal to start part %d, not %d", me, idxTmp, partIdx); ! biffAdd(LIMN, err); airMopError(mop); return 1; } airArrayIncrLen(vertBaseArr, 1); *************** *** 199,203 **** "for vert %d (of %d)", me, line, vertGot, vertNum); ! biffAdd(LIMN, err); return 1; } if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { --- 201,205 ---- "for vert %d (of %d)", me, line, vertGot, vertNum); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { *************** *** 232,236 **** sprintf(err, "%s: (near line %d) hit EOF trying to read face %d (of %d)", me, lineCount, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; } if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { --- 234,238 ---- sprintf(err, "%s: (near line %d) hit EOF trying to read face %d (of %d)", me, lineCount, faceGot, faceNum); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { *************** *** 241,245 **** "part %d, not %d", me, lineCount, idxTmp, partIdx); ! biffAdd(LIMN, err); return 1; } } --- 243,247 ---- "part %d, not %d", me, lineCount, idxTmp, partIdx); ! biffAdd(LIMN, err); airMopError(mop); return 1; } } *************** *** 250,254 **** "(#verts) from \"%s\" for face %d (of %d)", me, lineCount, line, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; } if (vertNum+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, vertNum+1)) { --- 252,256 ---- "(#verts) from \"%s\" for face %d (of %d)", me, lineCount, line, faceGot, faceNum); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (vertNum+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, vertNum+1)) { *************** *** 256,260 **** "for face %d (of %d)", me, lineCount, vertNum+1, line, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; } if (vertNum+1+3 == airParseStrF(fbuff, line, --- 258,262 ---- "for face %d (of %d)", me, lineCount, vertNum+1, line, faceGot, faceNum); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (vertNum+1+3 == airParseStrF(fbuff, line, *************** *** 283,287 **** faceGot++; } ! return 0; } --- 285,290 ---- faceGot++; } ! ! airMopOkay(mop); return 0; } |
|
From: <kin...@us...> - 2004-02-10 04:45:42
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16344 Modified Files: io.c obj.c renderLimn.c transform.c Log Message: final testing Index: io.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/io.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** io.c 9 Feb 2004 23:47:32 -0000 1.10 --- io.c 10 Feb 2004 04:42:18 -0000 1.11 *************** *** 63,71 **** fprintf(file, "]; wn = (%g,%g,%g)", face->worldNormal[0], face->worldNormal[1], face->worldNormal[2]); ! if (face->lookIdx) { ! look = obj->look + face->lookIdx; ! fprintf(file, "; RGB=(%g,%g,%g)", ! look->rgba[0], look->rgba[1], look->rgba[2]); ! } fprintf(file, "\n"); } --- 63,69 ---- fprintf(file, "]; wn = (%g,%g,%g)", face->worldNormal[0], face->worldNormal[1], face->worldNormal[2]); ! look = obj->look + face->lookIdx; ! fprintf(file, "; RGB=(%g,%g,%g)", ! look->rgba[0], look->rgba[1], look->rgba[2]); fprintf(file, "\n"); } *************** *** 88,98 **** } fprintf(file, "OFF # created by teem/limn\n"); ! /* there will be (obj->partNum - 1) dummy vertices marking ! the boundary between different parts */ ! fprintf(file, "%d %d %d\n", obj->vertNum + obj->partNum - 1, ! obj->faceNum, obj->edgeNum); /* write vertices */ for (partIdx=0; partIdx<obj->partNum; partIdx++) { part = obj->part + partIdx; for (vii=0; vii<part->vertIdxNum; vii++) { --- 86,94 ---- } fprintf(file, "OFF # created by teem/limn\n"); ! fprintf(file, "%d %d %d\n", obj->vertNum, obj->faceNum, obj->edgeNum); /* write vertices */ for (partIdx=0; partIdx<obj->partNum; partIdx++) { + fprintf(file, "### LIMN BEGIN PART %d\n", partIdx); part = obj->part + partIdx; for (vii=0; vii<part->vertIdxNum; vii++) { *************** *** 111,122 **** fprintf(file, "\n"); } - /* dummy vertex, but not after last part */ - if (partIdx<obj->partNum-1) { - fprintf(file, "666 666 666 # end part %d\n", partIdx); - } } /* write faces */ for (partIdx=0; partIdx<obj->partNum; partIdx++) { part = obj->part + partIdx; for (fii=0; fii<part->faceIdxNum; fii++) { --- 107,115 ---- fprintf(file, "\n"); } } /* write faces */ for (partIdx=0; partIdx<obj->partNum; partIdx++) { + fprintf(file, "### LIMN BEGIN PART %d\n", partIdx); part = obj->part + partIdx; for (fii=0; fii<part->faceIdxNum; fii++) { *************** *** 124,128 **** fprintf(file, "%d", face->sideNum); for (si=0; si<face->sideNum; si++) { ! fprintf(file, " %d", part->vertIdx[face->vertIdxIdx[si]] + partIdx); } if (face->lookIdx) { --- 117,121 ---- fprintf(file, "%d", face->sideNum); for (si=0; si<face->sideNum; si++) { ! fprintf(file, " %d", part->vertIdx[face->vertIdxIdx[si]]); } if (face->lookIdx) { *************** *** 136,169 **** } - #if 0 /* before the OFF vertex hijack to delineate parts */ - for (ii=0; ii<obj->pA->len; ii++) { - p = obj->p + ii; - fprintf(file, "%g %g %g", - p->w[0]/p->w[3], p->w[1]/p->w[3], p->w[2]/p->w[3]); - if (p->lookIdx) { - /* its a non-default color */ - fprintf(file, " %g %g %g", - obj->look[p->lookIdx].rgba[0], - obj->look[p->lookIdx].rgba[1], - obj->look[p->lookIdx].rgba[2]); - } - fprintf(file, "\n"); - } - for (ii=0; ii<obj->fA->len; ii++) { - f = obj->f + ii; - fprintf(file, "%d", f->vNum); - for (vi=0; vi<f->vNum; vi++) { - fprintf(file, " %d", obj->v[vi + f->vBase]); - } - if (f->sp) { - fprintf(file, " %g %g %g", - obj->look[f->lookIdx].rgba[0], - obj->look[f->lookIdx].rgba[1], - obj->look[f->lookIdx].rgba[2]); - } - fprintf(file, "\n"); - } - #endif - return 0; } --- 129,132 ---- *************** *** 174,182 **** double vert[6]; char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */ ! int lookIdx, ri, lret, nvert, nface, ii, got; int ibuff[512]; /* HEY: bad Gordon */ float fbuff[512]; /* HEY: bad bad Gordon */ ! int *rlut; ! airArray *mop; if (!( obj && file )) { --- 137,148 ---- double vert[6]; char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */ ! int lineCount, lookIdx, partIdx, idxTmp, lret, vertNum, vertGot, ! faceNum, vii, faceGot, got; int ibuff[512]; /* HEY: bad Gordon */ float fbuff[512]; /* HEY: bad bad Gordon */ ! float lastRGB[3]; int lastLook; ! ! int *vertBase; ! airArray *vertBaseArr; if (!( obj && file )) { *************** *** 184,188 **** --- 150,158 ---- biffAdd(LIMN, err); return 1; } + vertBase = NULL; + vertBaseArr = airArrayNew((void**)&vertBase, NULL, + sizeof(int), 128); got = 0; + lineCount = 0; do { if (!airOneLine(file, line, AIR_STRLEN_LARGE)) { *************** *** 190,264 **** biffAdd(LIMN, err); return 1; } got = airParseStrI(ibuff, line, AIR_WHITESPACE, 3); } while (3 != got); ! nvert = ibuff[0]; ! nface = ibuff[1]; ! mop = airMopNew(); ! rlut = (int*)calloc(nvert, sizeof(int)); ! airMopAdd(mop, rlut, airFree, airMopAlways); ! ri = -1; /* ssh */ ! for (ii=0; ii<nvert; ii++) { do { lret = airOneLine(file, line, AIR_STRLEN_LARGE); } while (1 == lret); if (!lret) { ! sprintf(err, "%s: hit EOF trying to read vert %d (of %d)", ! me, ii, nvert); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (3 != airParseStrD(vert, line, AIR_WHITESPACE, 3)) { sprintf(err, "%s: couldn't parse 3 doubles from \"%s\" " "for vert %d (of %d)", ! me, line, ii, nvert); ! biffAdd(LIMN, err); airMopError(mop); return 1; ! } ! if (!ii || (666 == vert[0] && 666 == vert[1] && 666 == vert[2])) { ! ri = limnObjectPartAdd(obj); } - rlut[ii] = ri; if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { /* we could also parse an RGB color */ ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, vert[3], vert[4], vert[5], 1); } else { lookIdx = 0; } ! limnObjectVertexAdd(obj, ri, lookIdx, vert[0], vert[1], vert[2]); } ! for (ii=0; ii<nface; ii++) { do { lret = airOneLine(file, line, AIR_STRLEN_LARGE); } while (1 == lret); if (!lret) { ! sprintf(err, "%s: hit EOF trying to read face %d (of %d)", ! me, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } ! if (1 != sscanf(line, "%d", &nvert)) { ! sprintf(err, "%s: can't get first int (#verts) from \"%s\" " ! "for face %d (of %d)", ! me, line, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } ! if (nvert+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, nvert+1)) { ! sprintf(err, "%s: couldn't parse %d ints from \"%s\" " "for face %d (of %d)", ! me, nvert+1, line, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } ! if (nvert+1+3 == airParseStrF(fbuff, line, AIR_WHITESPACE, nvert+1+3)) { /* could also parse color */ ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, ! fbuff[nvert+1+0], fbuff[nvert+1+1], fbuff[nvert+1+2], 1); } else { lookIdx = 0; } ! limnObjectFaceAdd(obj, rlut[ibuff[1]], lookIdx, nvert, ibuff+1); } - airMopOkay(mop); return 0; } - --- 160,287 ---- biffAdd(LIMN, err); return 1; } + lineCount++; got = airParseStrI(ibuff, line, AIR_WHITESPACE, 3); } while (3 != got); ! vertNum = ibuff[0]; ! faceNum = ibuff[1]; ! /* read all vertex information */ ! lastLook = -1; ! partIdx = limnObjectPartAdd(obj); ! vertGot = 0; ! airArrayIncrLen(vertBaseArr, 1); ! vertBase[partIdx] = vertGot; ! while (vertGot < vertNum) { do { lret = airOneLine(file, line, AIR_STRLEN_LARGE); + lineCount++; } while (1 == lret); if (!lret) { ! sprintf(err, "%s: (near line %d) hit EOF trying to read vert %d (of %d)", ! me, lineCount, vertGot, vertNum); ! biffAdd(LIMN, err); return 1; ! } ! if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { ! if (idxTmp != 0) { ! partIdx = limnObjectPartAdd(obj); ! if (idxTmp != partIdx) { ! sprintf(err, "%s: got signal to start part %d, not %d", ! me, idxTmp, partIdx); ! biffAdd(LIMN, err); return 1; ! } ! airArrayIncrLen(vertBaseArr, 1); ! vertBase[partIdx] = vertGot; ! } ! continue; } if (3 != airParseStrD(vert, line, AIR_WHITESPACE, 3)) { sprintf(err, "%s: couldn't parse 3 doubles from \"%s\" " "for vert %d (of %d)", ! me, line, vertGot, vertNum); ! biffAdd(LIMN, err); return 1; } if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { /* we could also parse an RGB color */ ! if (-1 == lastLook || !ELL_3V_EQUAL(lastRGB, vert+3)) { ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, vert[3], vert[4], vert[5], 1); ! lastLook = lookIdx; ! ELL_3V_COPY(lastRGB, vert+3); ! } else { ! lookIdx = lastLook; ! } } else { lookIdx = 0; } ! /* ! fprintf(stderr, "line %d: vertGot = %d; lookIdx = %d; partIdx = %d\n", ! lineCount, vertGot, lookIdx, partIdx); ! */ ! limnObjectVertexAdd(obj, partIdx, lookIdx, vert[0], vert[1], vert[2]); ! vertGot++; } ! /* read face information */ ! partIdx = 0; ! faceGot = 0; ! while (faceGot < faceNum) { do { lret = airOneLine(file, line, AIR_STRLEN_LARGE); + lineCount++; } while (1 == lret); if (!lret) { ! sprintf(err, "%s: (near line %d) hit EOF trying to read face %d (of %d)", ! me, lineCount, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; } ! if (1 == sscanf(line, "### LIMN BEGIN PART %d", &idxTmp)) { ! if (idxTmp != 0) { ! partIdx += 1; ! if (idxTmp != partIdx) { ! sprintf(err, "%s: (near line %d) got signal to start " ! "part %d, not %d", ! me, lineCount, idxTmp, partIdx); ! biffAdd(LIMN, err); return 1; ! } ! } ! continue; } ! if (1 != sscanf(line, "%d", &vertNum)) { ! sprintf(err, "%s: (near line %d) can't get first int " ! "(#verts) from \"%s\" for face %d (of %d)", ! me, lineCount, line, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; ! } ! if (vertNum+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, vertNum+1)) { ! sprintf(err, "%s: (near line %d) couldn't parse %d ints from \"%s\" " "for face %d (of %d)", ! me, lineCount, vertNum+1, line, faceGot, faceNum); ! biffAdd(LIMN, err); return 1; } ! if (vertNum+1+3 == airParseStrF(fbuff, line, ! AIR_WHITESPACE, vertNum+1+3)) { /* could also parse color */ ! if (-1 == lastLook || !ELL_3V_EQUAL(lastRGB, fbuff+vertNum+1)) { ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, fbuff[vertNum+1+0], ! fbuff[vertNum+1+1], fbuff[vertNum+1+2], 1); ! lastLook = lookIdx; ! ELL_3V_COPY(lastRGB, fbuff+vertNum+1); ! } else { ! lookIdx = lastLook; ! } } else { lookIdx = 0; } ! for (vii=0; vii<vertNum; vii++) { ! (ibuff+1)[vii] -= vertBase[partIdx]; ! } ! /* ! fprintf(stderr, "line %d: faceGot = %d; lookIdx = %d; partIdx = %d\n", ! lineCount, faceGot, lookIdx, partIdx); ! */ ! limnObjectFaceAdd(obj, partIdx, lookIdx, vertNum, ibuff+1); ! faceGot++; } return 0; } Index: obj.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/obj.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** obj.c 9 Feb 2004 23:47:32 -0000 1.17 --- obj.c 10 Feb 2004 04:42:18 -0000 1.18 *************** *** 170,174 **** for (edgeIdxIdx=0; edgeIdxIdx<part->edgeIdxNum; edgeIdxIdx++) { edgeIdx = part->edgeIdx[edgeIdxIdx]; ! edge = &(obj->edge[edgeIdx]); if (edge->vertIdxIdx[0] == vertIdxIdx0 && edge->vertIdxIdx[1] == vertIdxIdx1) { --- 170,174 ---- for (edgeIdxIdx=0; edgeIdxIdx<part->edgeIdxNum; edgeIdxIdx++) { edgeIdx = part->edgeIdx[edgeIdxIdx]; ! edge = obj->edge + edgeIdx; if (edge->vertIdxIdx[0] == vertIdxIdx0 && edge->vertIdxIdx[1] == vertIdxIdx1) { *************** *** 179,183 **** /* edge not found, add it */ edgeIdx = airArrayIncrLen(obj->edgeArr, 1); ! edge = &(obj->edge[edgeIdx]); edgeIdxIdx = airArrayIncrLen(part->edgeIdxArr, 1); part->edgeIdx[edgeIdxIdx] = edgeIdx; --- 179,183 ---- /* edge not found, add it */ edgeIdx = airArrayIncrLen(obj->edgeArr, 1); ! edge = obj->edge + edgeIdx; edgeIdxIdx = airArrayIncrLen(part->edgeIdxArr, 1); part->edgeIdx[edgeIdxIdx] = edgeIdx; Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** renderLimn.c 9 Feb 2004 23:47:32 -0000 1.18 --- renderLimn.c 10 Feb 2004 04:42:18 -0000 1.19 *************** *** 247,251 **** edge = obj->edge + part->edgeIdx[eii]; face0 = obj->face + part->faceIdx[edge->faceIdxIdx[0]]; ! face1 = (-1 == edge->faceIdxIdx[0] ? NULL : obj->face + part->faceIdx[edge->faceIdxIdx[1]]); --- 247,251 ---- edge = obj->edge + part->edgeIdx[eii]; face0 = obj->face + part->faceIdx[edge->faceIdxIdx[0]]; ! face1 = (-1 == edge->faceIdxIdx[1] ? NULL : obj->face + part->faceIdx[edge->faceIdxIdx[1]]); Index: transform.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/transform.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** transform.c 9 Feb 2004 22:48:01 -0000 1.18 --- transform.c 10 Feb 2004 04:42:18 -0000 1.19 *************** *** 68,71 **** --- 68,72 ---- ELL_3V_ADD2(nn, nn, cross); } + if (limnSpaceWorld == space) { ELL_3V_NORM(face->worldNormal, nn, norm); |
|
From: <kin...@us...> - 2004-02-10 04:45:42
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16344/test Modified Files: off2eps.c soid.c Log Message: final testing Index: off2eps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/off2eps.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** off2eps.c 9 Feb 2004 23:47:32 -0000 1.3 --- off2eps.c 10 Feb 2004 04:42:19 -0000 1.4 *************** *** 112,115 **** --- 112,120 ---- airMopError(mop); return 1; } + if (describe) { + fprintf(stdout, "----------------- POST-READ -----------------\n"); + limnObjectDescribe(stdout, obj); + fprintf(stdout, "----------------- POST-READ -----------------\n"); + } win = limnWindowNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; *************** *** 137,141 **** --- 142,148 ---- if (describe) { + fprintf(stdout, "----------------- POST-RENDER -----------------\n"); limnObjectDescribe(stdout, obj); + fprintf(stdout, "----------------- POST-RENDER -----------------\n"); } Index: soid.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/soid.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** soid.c 9 Feb 2004 22:48:01 -0000 1.7 --- soid.c 10 Feb 2004 04:42:19 -0000 1.8 *************** *** 58,62 **** airArray *mop; limnObject *obj; ! limnLook *look; int lookIdx; limnPart *part; int partIdx; int res, axis, sphere; --- 58,62 ---- airArray *mop; limnObject *obj; ! limnLook *look; int lookRod, lookSoid; limnPart *part; int partIdx; int res, axis, sphere; *************** *** 93,103 **** airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); ! /* create limnLooks for ellipsoid (#0) and for rods (#1) */ ! lookIdx = airArrayIncrLen(obj->lookArr, 2); ! look = obj->look + lookIdx + 0; ELL_4V_SET(look->rgba, 1, 1, 1, 1); ELL_3V_SET(look->kads, 0.2, 0.8, 0); look->spow = 0; ! look = obj->look + lookIdx + 1; ELL_4V_SET(look->rgba, 0, 0, 0, 1); ELL_3V_SET(look->kads, 1, 0, 0); --- 93,104 ---- airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); ! /* create limnLooks for ellipsoid and for rods */ ! lookSoid = limnObjectLookAdd(obj); ! look = obj->look + lookSoid; ELL_4V_SET(look->rgba, 1, 1, 1, 1); ELL_3V_SET(look->kads, 0.2, 0.8, 0); look->spow = 0; ! lookRod = limnObjectLookAdd(obj); ! look = obj->look + lookRod; ELL_4V_SET(look->rgba, 0, 0, 0, 1); ELL_3V_SET(look->kads, 1, 0, 0); *************** *** 129,135 **** if (sphere) { ! partIdx = limnObjectPolarSphereAdd(obj, 0, 0, 2*res, res); } else { ! partIdx = limnObjectPolarSuperquadAdd(obj, 0, axis, qA, qB, 2*res, res); } part = obj->part + partIdx; --- 130,138 ---- if (sphere) { ! partIdx = limnObjectPolarSphereAdd(obj, lookSoid, ! 0, 2*res, res); } else { ! partIdx = limnObjectPolarSuperquadAdd(obj, lookSoid, ! axis, qA, qB, 2*res, res); } part = obj->part + partIdx; *************** *** 142,146 **** if (rad) { ! partIdx = limnObjectCylinderAdd(obj, 1, 0, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); --- 145,149 ---- if (rad) { ! partIdx = limnObjectCylinderAdd(obj, lookRod, 0, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); *************** *** 150,154 **** limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 0, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); --- 153,157 ---- limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, lookRod, 0, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); *************** *** 158,162 **** limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 1, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); --- 161,165 ---- limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, lookRod, 1, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); *************** *** 166,170 **** limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 1, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); --- 169,173 ---- limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, lookRod, 1, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); *************** *** 174,178 **** limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 2, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); --- 177,181 ---- limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, lookRod, 2, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); *************** *** 182,186 **** limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 2, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); --- 185,189 ---- limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, lookRod, 2, res); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); |
|
From: <kin...@us...> - 2004-02-10 04:40:18
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8142/test Modified Files: off2eps.c soid.c tps.c Log Message: sorry, beginning debugging of limnObject re-write Index: off2eps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/off2eps.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** off2eps.c 9 Feb 2004 07:02:04 -0000 1.1 --- off2eps.c 9 Feb 2004 22:48:01 -0000 1.2 *************** *** 30,39 **** hestOpt *hopt=NULL; airArray *mop; ! limnObj *obj; ! limnSP *sp; ! limnWin *win; Nrrd *nmap; FILE *file; ! int si, wire; mop = airMopNew(); --- 30,39 ---- hestOpt *hopt=NULL; airArray *mop; ! limnObject *obj; ! limnLook *look; int lookIdx; ! limnWindow *win; Nrrd *nmap; FILE *file; ! int wire, concave; mop = airMopNew(); *************** *** 65,68 **** --- 65,71 ---- 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", *************** *** 90,95 **** } ! obj = limnObjNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjNix, airMopAlways); if (!(file = airFopen(inS, stdin, "r"))) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS); --- 93,98 ---- } ! obj = limnObjectNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); if (!(file = airFopen(inS, stdin, "r"))) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS); *************** *** 97,106 **** } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); ! si = airArrayIncrLen(obj->sA, 2); ! sp = obj->s + si + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); /* this is kind of silly */ ! ELL_3V_SET(sp->k, 0.2, 0.8, 0); ! sp->spec = 0; ! if (limnObjOFFRead(obj, file)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); --- 100,109 ---- } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); ! lookIdx = airArrayIncrLen(obj->lookArr, 2); ! look = obj->look + lookIdx + 0; ! ELL_4V_SET(look->rgba, 1, 1, 1, 1); /* this is kind of silly */ ! ELL_3V_SET(look->kads, 0.2, 0.8, 0); ! look->spow = 0; ! if (limnObjectOFFRead(obj, file)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); *************** *** 108,112 **** } ! win = limnWinNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; win->ps.lineWidth[limnEdgeTypeBackCrease] = edgeWidth[1]; --- 111,115 ---- } ! win = limnWindowNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; win->ps.lineWidth[limnEdgeTypeBackCrease] = edgeWidth[1]; *************** *** 119,127 **** win->file = airFopen(outS, stdout, "w"); ! airMopAdd(mop, win, (airMopper)limnWinNix, airMopAlways); win->scale = winscale; ! if (limnObjRender(obj, cam, win) ! || limnObjPSDraw(obj, cam, nmap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); --- 122,132 ---- win->file = airFopen(outS, stdout, "w"); ! airMopAdd(mop, win, (airMopper)limnWindowNix, airMopAlways); win->scale = winscale; ! 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); Index: soid.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/soid.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** soid.c 9 Feb 2004 07:05:33 -0000 1.6 --- soid.c 9 Feb 2004 22:48:01 -0000 1.7 *************** *** 54,64 **** 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, sc[3], rad, edgeWidth[5]; hestOpt *hopt=NULL; airArray *mop; ! limnObj *obj; ! limnSP *sp; ! limnPart *r; ! int ri, si, res, axis, sphere; FILE *file; --- 54,64 ---- 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 lookIdx; ! limnPart *part; int partIdx; ! int res, axis, sphere; FILE *file; *************** *** 68,72 **** edgeWidth[1] = 0; me = argv[0]; ! hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, sc, "1 1 1", "axis-aligned scaling to do on ellipsoid"); hestOptAdd(&hopt, "os", "over-all scaling", airTypeFloat, 1, 1, &os, "1", --- 68,72 ---- edgeWidth[1] = 0; me = argv[0]; ! hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, eval, "1 1 1", "axis-aligned scaling to do on ellipsoid"); hestOptAdd(&hopt, "os", "over-all scaling", airTypeFloat, 1, 1, &os, "1", *************** *** 90,106 **** airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); ! obj = limnObjNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjNix, airMopAlways); ! /* create limnSPs for ellipsoid (#0) and for rods (#1) */ ! si = airArrayIncrLen(obj->sA, 2); ! sp = obj->s + si + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ! ELL_3V_SET(sp->k, 0.2, 0.8, 0); ! sp->spec = 0; ! sp = obj->s + si + 1; ! ELL_4V_SET(sp->rgba, 0, 0, 0, 1); ! ELL_3V_SET(sp->k, 1, 0, 0); ! sp->spec = 0; q[0] = 1.0; --- 90,106 ---- airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); ! obj = limnObjectNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); ! /* create limnLooks for ellipsoid (#0) and for rods (#1) */ ! lookIdx = airArrayIncrLen(obj->lookArr, 2); ! look = obj->look + lookIdx + 0; ! ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 0.2, 0.8, 0); ! look->spow = 0; ! look = obj->look + lookIdx + 1; ! ELL_4V_SET(look->rgba, 0, 0, 0, 1); ! ELL_3V_SET(look->kads, 1, 0, 0); ! look->spow = 0; q[0] = 1.0; *************** *** 112,126 **** washQtoM3(mR, q); ! sc[0] *= os; sc[1] *= os; sc[2] *= os; ! ELL_3V_COPY(eval, sc); 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(sc[0], sc[1], sc[2]); qA = pow(1-cp, sh); qB = pow(1-cl, sh); } else { ! axis = ELL_MIN3_IDX(sc[0], sc[1], sc[2]); qA = pow(1-cl, sh); qB = pow(1-cp, sh); --- 112,125 ---- 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); *************** *** 130,200 **** if (sphere) { ! ri = limnObjPolarSphereAdd(obj, 0, 0, 2*res, res); } else { ! ri = limnObjPolarSuperquadAdd(obj, 0, axis, qA, qB, 2*res, res); } ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, sc[0], sc[1], sc[2]); ell_4m_post_mul_f(matA, matB); ELL_43M_INSET(matB, mR); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); if (rad) { ! ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, (1+sc[0])/2, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, -(1+sc[0])/2, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ! ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, (1+sc[1])/2, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, -(1+sc[1])/2, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, (1+sc[2])/2); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, -(1+sc[2])/2); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); } --- 129,192 ---- if (sphere) { ! partIdx = limnObjectPolarSphereAdd(obj, 0, 0, 2*res, res); } else { ! partIdx = limnObjectPolarSuperquadAdd(obj, 0, axis, qA, qB, 2*res, res); } ! part = obj->part + partIdx; ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, eval[0], eval[1], eval[2]); ell_4m_post_mul_f(matA, matB); ELL_43M_INSET(matB, mR); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); if (rad) { ! partIdx = limnObjectCylinderAdd(obj, 1, 0, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, (1+eval[0])/2, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 0, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, (1-eval[0])/2, rad, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, -(1+eval[0])/2, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 1, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, (1+eval[1])/2, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 1, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, (1-eval[1])/2, rad); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, -(1+eval[1])/2, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 2, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, (1+eval[2])/2); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 1, 2, res); ELL_4M_IDENTITY_SET(matA); ! ELL_4M_SCALE_SET(matB, rad, rad, (1-eval[2])/2); ell_4m_post_mul_f(matA, matB); ! ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, -(1+eval[2])/2); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); } *************** *** 202,206 **** airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); ! if (limnObjOFFWrite(file, obj)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); --- 194,198 ---- airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); ! if (limnObjectOFFWrite(file, obj)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); Index: tps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/tps.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tps.c 7 Jan 2004 15:34:30 -0000 1.9 --- tps.c 9 Feb 2004 22:48:01 -0000 1.10 *************** *** 30,37 **** hestOpt *hopt=NULL; airArray *mop; ! limnObj *obj; ! limnSP *sp; ! limnWin *win; ! int ri, si; Nrrd *nmap; --- 30,37 ---- hestOpt *hopt=NULL; airArray *mop; ! limnObject *obj; ! limnLook *look; int lookIdx; ! limnWindow *win; ! int partIdx; Nrrd *nmap; *************** *** 75,135 **** return 1; } ! obj = limnObjNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjNix, airMopAlways); ! /* create limnSPs for diffuse (#0) and flat (#1) shading */ ! si = airArrayIncrLen(obj->sA, 2); ! sp = obj->s + si + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ! ELL_3V_SET(sp->k, 0, 1, 0); ! sp->spec = 0; ! sp = obj->s + si + 1; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ! ELL_3V_SET(sp->k, 1, 0, 0); ! sp->spec = 0; ! ri = limnObjCylinderAdd(obj, 0, 0, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 1, 0.2, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 1.3, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(obj, 0, 1, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.2, 1, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 1.3, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjCylinderAdd(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); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjPolarSphereAdd(obj, 0, 0, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 2.6, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjPolarSphereAdd(obj, 0, 1, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 2.6); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! ri = limnObjPolarSphereAdd(obj, 0, 2, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 3.2); ell_4m_post_mul_f(matA, matB); ! limnObjPartTransform(obj, ri, matA); ! win = limnWinNew(limnDevicePS); win->file = fopen(outS, "w"); ! airMopAdd(mop, win, (airMopper)limnWinNix, airMopAlways); ! if (limnObjRender(obj, cam, win) ! || limnObjPSDraw(obj, cam, nmap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); --- 75,135 ---- return 1; } ! obj = limnObjectNew(10, AIR_TRUE); ! airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); ! /* create limnLooks for diffuse (#0) and flat (#1) shading */ ! lookIdx = airArrayIncrLen(obj->lookArr, 2); ! look = obj->look + lookIdx + 0; ! ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 0, 1, 0); ! look->spow = 0; ! look = obj->look + lookIdx + 1; ! ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 1, 0, 0); ! look->spow = 0; ! partIdx = limnObjectCylinderAdd(obj, 0, 0, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 1, 0.2, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 1.3, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectCylinderAdd(obj, 0, 1, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.2, 1, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 1.3, 0.0); ell_4m_post_mul_f(matA, matB); ! 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); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 2.6, 0.0); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectPolarSphereAdd(obj, 0, 1, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 2.6); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! partIdx = limnObjectPolarSphereAdd(obj, 0, 2, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 3.2); ell_4m_post_mul_f(matA, matB); ! limnObjectPartTransform(obj, partIdx, matA); ! win = limnWindowNew(limnDevicePS); win->file = fopen(outS, "w"); ! airMopAdd(mop, win, (airMopper)limnWindowNix, airMopAlways); ! 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); |
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8142 Modified Files: GNUmakefile io.c limn.h methodsLimn.c obj.c renderLimn.c shapes.c transform.c Log Message: sorry, beginning debugging of limnObject re-write Index: GNUmakefile =================================================================== RCS file: /cvsroot/teem/teem/src/limn/GNUmakefile,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** GNUmakefile 9 Feb 2004 07:02:05 -0000 1.16 --- GNUmakefile 9 Feb 2004 22:48:01 -0000 1.17 *************** *** 47,52 **** $(L).PUBLIC_HEADERS = limn.h $(L).PRIVATE_HEADERS = ! $(L).OBJS = defaultsLimn.o qn.o light.o env.o cam.o methodsLimn.o obj.o io.o \ ! hestLimn.o transform.o shapes.o renderLimn.o \ splineMisc.o splineMethods.o splineEval.o $(L).TESTS = test/map test/light test/tcam test/tps test/tspline test/tbc \ --- 47,52 ---- $(L).PUBLIC_HEADERS = limn.h $(L).PRIVATE_HEADERS = ! $(L).OBJS = defaultsLimn.o qn.o light.o env.o cam.o methodsLimn.o \ ! obj.o transform.o shapes.o renderLimn.o io.o hestLimn.o \ splineMisc.o splineMethods.o splineEval.o $(L).TESTS = test/map test/light test/tcam test/tps test/tspline test/tbc \ Index: io.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/io.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** io.c 9 Feb 2004 07:06:18 -0000 1.8 --- io.c 9 Feb 2004 22:48:01 -0000 1.9 *************** *** 22,60 **** int ! limnObjDescribe(FILE *file, limnObj *obj) { ! int j, i, vi; ! limnFace *f; ! limnEdge *e; ! limnPoint *p; ! limnPart *r; ! fprintf(file, "parts: %d\n", obj->rA->len); ! for (j=0; j<=obj->rA->len-1; j++) { ! r = &(obj->r[j]); ! fprintf(file, "%d | points: %d\n", j, r->pNum); ! for (i=0; i<=r->pNum-1; i++) { ! p = &(obj->p[r->pBase + i]); ! fprintf(file, "%d | %d(%d): w=(%g,%g,%g)\tv=(%g,%g,%g)\ts(%g,%g,%g)\n", ! j, i, r->pBase + i, ! p->w[0], p->w[1], p->w[2], ! p->v[0], p->v[1], p->v[2], ! p->s[0], p->s[1], p->s[2]); } ! fprintf(file, "%d | edges: %d\n", j, r->eNum); ! for (i=0; i<=r->eNum-1; i++) { ! e = &(obj->e[r->eBase + i]); ! fprintf(file, "%d | %d(%d): vert(%d,%d), face(%d,%d)\n", ! j, i, r->eBase + i, e->v0, e->v1, e->f0, e->f1); } ! fprintf(file, "%d | faces: %d\n", j, r->fNum); ! for (i=0; i<=r->fNum-1; i++) { ! f = &(obj->f[r->fBase + i]); ! fprintf(file, "%d | %d(%d): [", j, i, r->fBase + i); ! for (vi=0; vi<=f->vNum-1; vi++) { ! fprintf(file, "%d", obj->v[f->vBase + vi]); ! if (vi < f->vNum-1) fprintf(file, ","); } ! fprintf(file, "]; wn = (%g,%g,%g)\n", f->wn[0], f->wn[1], f->wn[2]); } } --- 22,64 ---- int ! limnObjectDescribe(FILE *file, limnObject *obj) { ! limnFace *face; int si, fii; ! limnEdge *edge; int eii; ! limnVertex *vert; int vii; ! limnPart *part; int partIdx; ! fprintf(file, "parts: %d\n", obj->partNum); ! for (partIdx=0; partIdx<obj->partNum; partIdx++) { ! part = obj->part + partIdx; ! fprintf(file, "part %d | verts: %d ========\n", partIdx, part->vertIdxNum); ! for (vii=0; vii<part->vertIdxNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; ! fprintf(file, "part %d | %d(%d): " ! "w=(%g,%g,%g)\tv=(%g,%g,%g)\ts(%g,%g,%g)\n", ! partIdx, vii, part->vertIdx[vii], ! vert->world[0], vert->world[1], vert->world[2], ! vert->view[0], vert->view[1], vert->view[2], ! vert->screen[0], vert->screen[1], vert->screen[2]); } ! fprintf(file, "part %d | edges: %d ========\n", partIdx, part->edgeIdxNum); ! for (eii=0; eii<part->edgeIdxNum; eii++) { ! edge = obj->edge + part->edgeIdx[eii]; ! fprintf(file, "part %d | %d(%d): " ! "vert(%d,%d), face(%d,%d)\n", ! partIdx, eii, part->edgeIdx[eii], ! edge->vertIdxIdx[0], edge->vertIdxIdx[1], ! edge->faceIdxIdx[0], edge->faceIdxIdx[1]); } ! fprintf(file, "part %d | faces: %d ========\n", partIdx, part->faceIdxNum); ! for (fii=0; fii<part->faceIdxNum; fii++) { ! face = obj->face + part->faceIdx[fii]; ! fprintf(file, "part %d | %d(%d): [", partIdx, fii, part->faceIdx[fii]); ! for (si=0; si<face->sideNum; si++) { ! fprintf(file, "%d", part->vertIdx[face->vertIdxIdx[si]]); ! if (si < face->sideNum-1) fprintf(file, ","); } ! fprintf(file, "]; wn = (%g,%g,%g)\n", face->worldNormal[0], ! face->worldNormal[1], face->worldNormal[2]); } } *************** *** 64,72 **** int ! limnObjOFFWrite(FILE *file, limnObj *obj) { ! char me[]="limnObjOFFWrite", err[AIR_STRLEN_MED]; ! int ii, vi; ! limnPoint *p; ! limnFace *f; if (!( obj && file )) { --- 68,77 ---- int ! limnObjectOFFWrite(FILE *file, limnObject *obj) { ! char me[]="limnObjectOFFWrite", err[AIR_STRLEN_MED]; ! int si; ! limnVertex *vert; int vii; ! limnFace *face; int fii; ! limnPart *part; int partIdx; if (!( obj && file )) { *************** *** 74,87 **** biffAdd(LIMN, err); return 1; } ! fprintf(file, "OFF\n"); ! fprintf(file, "%d %d -1\n", obj->pA->len, obj->fA->len); for (ii=0; ii<obj->pA->len; ii++) { p = obj->p + ii; fprintf(file, "%g %g %g", p->w[0]/p->w[3], p->w[1]/p->w[3], p->w[2]/p->w[3]); ! if (p->sp) { /* its a non-default color */ ! fprintf(file, " %g %g %g", obj->s[p->sp].rgba[0], ! obj->s[p->sp].rgba[1], obj->s[p->sp].rgba[2]); } fprintf(file, "\n"); --- 79,142 ---- biffAdd(LIMN, err); return 1; } ! fprintf(file, "OFF # created by teem/limn\n"); ! /* there will be (obj->partNum - 1) dummy vertices marking ! the boundary between different parts */ ! fprintf(file, "%d %d %d\n", obj->vertNum + obj->partNum - 1, ! obj->faceNum, obj->edgeNum); ! ! /* write vertices */ ! for (partIdx=0; partIdx<obj->partNum; partIdx++) { ! part = obj->part + partIdx; ! for (vii=0; vii<part->vertIdxNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; ! fprintf(file, "%g %g %g", ! vert->world[0]/vert->world[3], ! vert->world[1]/vert->world[3], ! vert->world[2]/vert->world[3]); ! if (vert->lookIdx) { ! /* its a non-default color */ ! fprintf(file, " %g %g %g", ! obj->look[vert->lookIdx].rgba[0], ! obj->look[vert->lookIdx].rgba[1], ! obj->look[vert->lookIdx].rgba[2]); ! } ! fprintf(file, "\n"); ! } ! /* dummy vertex, but not after last part */ ! if (partIdx<obj->partNum-1) { ! fprintf(file, "666 666 666 # end part %d\n", partIdx); ! } ! } ! ! /* write faces */ ! for (partIdx=0; partIdx<obj->partNum; partIdx++) { ! part = obj->part + partIdx; ! for (fii=0; fii<part->faceIdxNum; fii++) { ! face = obj->face + part->faceIdx[fii]; ! fprintf(file, "%d", face->sideNum); ! for (si=0; si<face->sideNum; si++) { ! fprintf(file, " %d", part->vertIdx[face->vertIdxIdx[si]] + partIdx); ! } ! if (face->lookIdx) { ! fprintf(file, " %g %g %g", ! obj->look[face->lookIdx].rgba[0], ! obj->look[face->lookIdx].rgba[1], ! obj->look[face->lookIdx].rgba[2]); ! } ! fprintf(file, "\n"); ! } ! } ! ! #if 0 /* before the OFF vertex hijack to delineate parts */ for (ii=0; ii<obj->pA->len; ii++) { p = obj->p + ii; fprintf(file, "%g %g %g", p->w[0]/p->w[3], p->w[1]/p->w[3], p->w[2]/p->w[3]); ! if (p->lookIdx) { /* its a non-default color */ ! fprintf(file, " %g %g %g", ! obj->look[p->lookIdx].rgba[0], ! obj->look[p->lookIdx].rgba[1], ! obj->look[p->lookIdx].rgba[2]); } fprintf(file, "\n"); *************** *** 94,112 **** } if (f->sp) { ! fprintf(file, " %g %g %g", obj->s[f->sp].rgba[0], ! obj->s[f->sp].rgba[1], obj->s[f->sp].rgba[2]); } fprintf(file, "\n"); } return 0; } int ! limnObjOFFRead(limnObj *obj, FILE *file) { ! char me[]="limnObjOFFRead", err[AIR_STRLEN_MED]; double vert[6]; ! char line[AIR_STRLEN_LARGE]; /* HEY: bad bad Gordon */ ! int si, lret, nvert, nface, ii, got, ibuff[512]; /* HEY: bad bad Gordon */ float fbuff[512]; /* HEY: bad bad Gordon */ if (!( obj && file )) { --- 149,174 ---- } if (f->sp) { ! fprintf(file, " %g %g %g", ! obj->look[f->lookIdx].rgba[0], ! obj->look[f->lookIdx].rgba[1], ! obj->look[f->lookIdx].rgba[2]); } fprintf(file, "\n"); } + #endif + return 0; } int ! limnObjectOFFRead(limnObject *obj, FILE *file) { ! char me[]="limnObjectOFFRead", err[AIR_STRLEN_MED]; double vert[6]; ! char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */ ! int lookIdx, ri, lret, nvert, nface, ii, got; ! int ibuff[512]; /* HEY: bad Gordon */ float fbuff[512]; /* HEY: bad bad Gordon */ + int *rlut; + airArray *mop; if (!( obj && file )) { *************** *** 124,128 **** nvert = ibuff[0]; nface = ibuff[1]; ! limnObjPartStart(obj); for (ii=0; ii<nvert; ii++) { do { --- 186,194 ---- nvert = ibuff[0]; nface = ibuff[1]; ! ! mop = airMopNew(); ! rlut = (int*)calloc(nvert, sizeof(int)); ! airMopAdd(mop, rlut, airFree, airMopAlways); ! ri = -1; /* ssh */ for (ii=0; ii<nvert; ii++) { do { *************** *** 132,136 **** sprintf(err, "%s: hit EOF trying to read vert %d (of %d)", me, ii, nvert); ! biffAdd(LIMN, err); return 1; } if (3 != airParseStrD(vert, line, AIR_WHITESPACE, 3)) { --- 198,202 ---- sprintf(err, "%s: hit EOF trying to read vert %d (of %d)", me, ii, nvert); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (3 != airParseStrD(vert, line, AIR_WHITESPACE, 3)) { *************** *** 138,151 **** "for vert %d (of %d)", me, line, ii, nvert); ! biffAdd(LIMN, err); return 1; } if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { /* we could also parse an RGB color */ ! si = limnObjSPAdd(obj); ! ELL_4V_SET(obj->s[si].rgba, vert[3], vert[4], vert[5], 1); } else { ! si = 0; } ! limnObjPointAdd(obj, si, vert[0], vert[1], vert[2]); } for (ii=0; ii<nface; ii++) { --- 204,221 ---- "for vert %d (of %d)", me, line, ii, nvert); ! biffAdd(LIMN, err); airMopError(mop); return 1; ! } ! if (!ii || (666 == vert[0] && 666 == vert[1] && 666 == vert[2])) { ! ri = limnObjectPartAdd(obj); } + rlut[ii] = ri; if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { /* we could also parse an RGB color */ ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, vert[3], vert[4], vert[5], 1); } else { ! lookIdx = 0; } ! limnObjectVertexAdd(obj, ri, lookIdx, vert[0], vert[1], vert[2]); } for (ii=0; ii<nface; ii++) { *************** *** 156,160 **** sprintf(err, "%s: hit EOF trying to read face %d (of %d)", me, ii, nface); ! biffAdd(LIMN, err); return 1; } if (1 != sscanf(line, "%d", &nvert)) { --- 226,230 ---- sprintf(err, "%s: hit EOF trying to read face %d (of %d)", me, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (1 != sscanf(line, "%d", &nvert)) { *************** *** 162,166 **** "for face %d (of %d)", me, line, ii, nface); ! biffAdd(LIMN, err); return 1; } if (nvert+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, nvert+1)) { --- 232,236 ---- "for face %d (of %d)", me, line, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (nvert+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, nvert+1)) { *************** *** 168,185 **** "for face %d (of %d)", me, nvert+1, line, ii, nface); ! biffAdd(LIMN, err); return 1; } if (nvert+1+3 == airParseStrF(fbuff, line, AIR_WHITESPACE, nvert+1+3)) { /* could also parse color */ ! si = limnObjSPAdd(obj); ! ELL_4V_SET(obj->s[si].rgba, fbuff[nvert+1+0], fbuff[nvert+1+1], fbuff[nvert+1+2], 1); } else { ! si = 0; } ! limnObjFaceAdd(obj, si, nvert, ibuff+1); } - limnObjPartFinish(obj); return 0; } --- 238,255 ---- "for face %d (of %d)", me, nvert+1, line, ii, nface); ! biffAdd(LIMN, err); airMopError(mop); return 1; } if (nvert+1+3 == airParseStrF(fbuff, line, AIR_WHITESPACE, nvert+1+3)) { /* could also parse color */ ! lookIdx = limnObjectLookAdd(obj); ! ELL_4V_SET(obj->look[lookIdx].rgba, fbuff[nvert+1+0], fbuff[nvert+1+1], fbuff[nvert+1+2], 1); } else { ! lookIdx = 0; } ! limnObjectFaceAdd(obj, rlut[ibuff[1]], lookIdx, nvert, ibuff+1); } + airMopOkay(mop); return 0; } Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** limn.h 9 Feb 2004 07:06:18 -0000 1.45 --- limn.h 9 Feb 2004 22:48:01 -0000 1.46 *************** *** 140,144 **** typedef struct { float lineWidth[LIMN_EDGE_TYPE_MAX+1], - haloWidth[LIMN_EDGE_TYPE_MAX+1], creaseAngle, /* difference between crease and facet, in *degrees* */ bg[3]; /* background color */ --- 140,143 ---- *************** *** 147,151 **** } limnOptsPS; ! typedef struct limnWin_t { limnOptsPS ps; int device; --- 146,150 ---- } limnOptsPS; ! typedef struct { limnOptsPS ps; int device; *************** *** 153,157 **** int yFlip; FILE *file; ! } limnWin; enum { --- 152,156 ---- int yFlip; FILE *file; ! } limnWindow; enum { *************** *** 165,169 **** /* ! ******** struct limnPoint ** ** all the information you might want for a point --- 164,180 ---- /* ! ******** struct limnLook ! ** ! ** surface properties: pretty much anything having to do with ! ** appearance, for points, edges, faces, etc. ! */ ! typedef struct { ! float rgba[4]; ! float kads[3], /* phong: ka, kd, ks */ ! spow; /* specular power */ ! } limnLook; ! ! /* ! ******** struct limnVertex ** ** all the information you might want for a point *************** *** 171,182 **** ** Has no dynamically allocated information or pointers */ ! typedef struct limnPoint_t { ! float w[4], /* world coordinates (homogeneous) */ ! v[4], /* view coordinates */ ! s[3], /* screen coordinates (device independant) */ ! d[2], /* device coordinates */ ! n[3]; /* vertex normal (world coords only) */ ! int sp; /* index into parent's SP list */ ! } limnPoint; /* --- 182,194 ---- ** Has no dynamically allocated information or pointers */ ! typedef struct { ! float world[4], /* world coordinates (homogeneous) */ ! view[4], /* view coordinates */ ! screen[3], /* screen coordinates (device independant) */ ! device[2], /* device coordinates */ ! worldNormal[3]; /* vertex normal (world coords only) */ ! int lookIdx, /* index into parent's look array */ ! partIdx; ! } limnVertex; /* *************** *** 188,196 **** */ typedef struct limnEdge_t { ! int v0, v1, /* two point indices (in parent's point list) */ ! f0, f1, /* two face indices (in parent's face list) */ ! sp; /* index into parent's SP list */ ! ! int type; /* from the limnEdgeType enum */ } limnEdge; --- 200,208 ---- */ typedef struct limnEdge_t { ! int vertIdxIdx[2], faceIdxIdx[2], ! lookIdx, /* index into parent's look array */ ! partIdx; ! int type, /* from the limnEdgeType enum */ ! once; /* flag used for certain kinds of rendering */ } limnEdge; *************** *** 203,213 **** */ typedef struct limnFace_t { ! float wn[3], /* normal in world space */ ! sn[3]; /* normal in screen space (post-perspective-divide) */ ! int vBase, vNum, /* start and length in parent's vertex array, "v" */ ! sp; /* index into parent's SP list, "s" */ ! ! int visib; /* is face currently visible (AIR_TRUE or AIR_FALSE) */ ! float z; /* for depth ordering */ } limnFace; --- 215,228 ---- */ typedef struct limnFace_t { ! float worldNormal[3], ! screenNormal[3]; ! int *vertIdxIdx, /* normal array (not airArray) of indices (in part's ! vertIdx) vertex indices (in object's vert) */ ! *edgeIdxIdx, /* likewise for edges */ ! sideNum; /* number of sides (allocated length of {vert,edge}IdxIdx */ ! int lookIdx, ! partIdx; ! int visible; /* is face currently visible (AIR_TRUE or AIR_FALSE) */ ! float depth; } limnFace; *************** *** 218,246 **** */ typedef struct limnPart_t { ! int fBase, fNum, /* start and length in parent's limnFace array, "f" */ ! eBase, eNum, /* start and length in parent's limnEdge array, "e" */ ! pBase, pNum, /* start and length in parent's limnPoint array, "p" */ ! origIdx; /* initial part index of this part */ ! ! float z; /* assuming that the occlusion graph between ! whole parts is acyclic, one depth value is ! good enough for painter's algorithm ordering ! of drawing */ ! int sp; /* index into parent's SP list, "s" */ } limnPart; /* ! ******** struct limnSP ! ** ! ** "surface" properties: pretty much anything having to do with ! ** appearance, for points, edges, faces, etc. ! */ ! typedef struct limnSP_t { ! float rgba[4]; ! float k[3], spec; ! } limnSP; ! ! /* ! ******** struct limnObj ** ** the beast used to represent polygonal objects --- 233,246 ---- */ typedef struct limnPart_t { ! int *vertIdx, vertIdxNum, ! *edgeIdx, edgeIdxNum, ! *faceIdx, faceIdxNum; ! airArray *vertIdxArr, *edgeIdxArr, *faceIdxArr; ! int lookIdx; ! float depth; } limnPart; /* ! ******** struct limnObject ** ** the beast used to represent polygonal objects *************** *** 248,275 **** ** Relies on many dynamically allocated arrays */ ! typedef struct limnObj_t { ! limnPoint *p; /* array of point structs */ ! airArray *pA; /* airArray around "p" */ ! ! int *v; /* array of vertex indices for all faces */ ! airArray *vA; /* airArray around "v" */ ! limnEdge *e; /* array of edge structs */ ! airArray *eA; /* airArray around "e" */ ! limnFace *f; /* array of face structs */ ! airArray *fA; /* airArray around "f" */ ! int *fSort; /* indices into "f", sorted by depth */ ! limnPart *r; /* array of part structs */ ! airArray *rA; /* arrArray around "r" */ ! limnSP *s; /* array of surface properties */ ! airArray *sA; /* airArray around "s" */ ! ! limnPart *rCurr; /* pointer to part under construction */ ! int edges; /* if non-zero, build edges as faces are added */ ! } limnObj; /* --- 248,271 ---- ** Relies on many dynamically allocated arrays */ ! typedef struct { ! limnVertex *vert; int vertNum; ! airArray *vertArr; ! limnEdge *edge; int edgeNum; ! airArray *edgeArr; ! limnFace *face; int faceNum; ! airArray *faceArr; ! int *faceSort; /* indices into "face", sorted by depth */ ! limnPart *part; int partNum; ! airArray *partArr; ! limnLook *look; int lookNum; ! airArray *lookArr; ! int doEdges, /* if non-zero, build edges as faces are added */ ! incr; /* increment to use with airArrays */ ! } limnObject; /* *************** *** 390,395 **** extern limnCamera *limnCameraNew(void); extern limnCamera *limnCameraNix(limnCamera *cam); ! extern limnWin *limnWinNew(int device); ! extern limnWin *limnWinNix(limnWin *win); /* hestLimn.c */ --- 386,391 ---- extern limnCamera *limnCameraNew(void); extern limnCamera *limnCameraNix(limnCamera *cam); ! extern limnWindow *limnWindowNew(int device); ! extern limnWindow *limnWindowNix(limnWindow *win); /* hestLimn.c */ *************** *** 410,454 **** /* obj.c */ ! extern limnObj *limnObjNew(int incr, int edges); ! extern limnObj *limnObjNix(limnObj *obj); ! extern int limnObjPointAdd(limnObj *obj, int sp, float x, float y, float z); ! extern int limnObjEdgeAdd(limnObj *obj, int sp, int face, int v0, int v1); ! extern int limnObjFaceAdd(limnObj *obj, int sp, int numVert, int *vert); ! extern int limnObjSPAdd(limnObj *obj); ! extern int limnObjPartStart(limnObj *obj); ! extern int limnObjPartFinish(limnObj *obj); /* io.c */ ! extern int limnObjDescribe(FILE *file, limnObj *obj); ! extern int limnObjOFFRead(limnObj *obj, FILE *file); ! extern int limnObjOFFWrite(FILE *file, limnObj *obj); /* shapes.c */ ! extern int limnObjCubeAdd(limnObj *obj, int sp); ! extern int limnObjSquareAdd(limnObj *obj, int sp); ! extern int limnObjLoneEdgeAdd(limnObj *obj, int sp); ! extern int limnObjCylinderAdd(limnObj *obj, int sp, int axis,int res); ! extern int limnObjPolarSphereAdd(limnObj *obj, int sp, int axis, ! int thetaRes, int phiRes); ! extern int limnObjConeAdd(limnObj *obj, int sp, int axis, int res); ! extern int limnObjPolarSuperquadAdd(limnObj *obj, int sp, int axis, ! float A, float B, int thetaRes, int phiRes); /* transform.c */ ! extern int limnObjHomog(limnObj *obj, int space); ! extern int limnObjNormals(limnObj *obj, int space); ! extern int limnObjSpaceTransform(limnObj *obj, limnCamera *cam, limnWin *win, ! int space); ! extern int limnObjPartTransform(limnObj *obj, int ri, float tx[16]); ! extern int limnObjDepthSortParts(limnObj *obj); ! extern int limnObjDepthSortFaces(limnObj *obj); /* renderLimn.c */ ! extern int limnObjRender(limnObj *obj, limnCamera *cam, limnWin *win); ! extern int limnObjPSDrawOld(limnObj *obj, limnCamera *cam, ! Nrrd *envMap, limnWin *win); ! extern int limnObjPSDraw(limnObj *obj, limnCamera *cam, ! Nrrd *envMap, limnWin *win); /* splineMethods.c */ --- 406,453 ---- /* obj.c */ ! extern int limnObjectLookAdd(limnObject *obj); ! extern limnObject *limnObjectNew(int incr, int doEdges); ! extern limnObject *limnObjectNix(limnObject *obj); ! extern int limnObjectPartAdd(limnObject *obj); ! extern int limnObjectVertexAdd(limnObject *obj, int partIdx, int lookIdx, ! float x, float y, float z); ! extern int limnObjectEdgeAdd(limnObject *obj, int partIdx, int lookIdx, ! int faceIdxIdx, int vertIdxIdx0, int vertIdxIdx1); ! extern int limnObjectFaceAdd(limnObject *obj, int partIdx, ! int lookIdx, int sideNum, int *vertIdxIdx); /* io.c */ ! extern int limnObjectDescribe(FILE *file, limnObject *obj); ! extern int limnObjectOFFRead(limnObject *obj, FILE *file); ! extern int limnObjectOFFWrite(FILE *file, limnObject *obj); /* shapes.c */ ! extern int limnObjectCubeAdd(limnObject *obj, int lookIdx); ! extern int limnObjectSquareAdd(limnObject *obj, int lookIdx); ! extern int limnObjectLoneEdgeAdd(limnObject *obj, int lookIdx); ! extern int limnObjectCylinderAdd(limnObject *obj, int lookIdx, ! int axis,int res); ! extern int limnObjectPolarSphereAdd(limnObject *obj, int lookIdx, int axis, int thetaRes, int phiRes); + extern int limnObjectConeAdd(limnObject *obj, int lookIdx, int axis, int res); + extern int limnObjectPolarSuperquadAdd(limnObject *obj, int lookIdx, int axis, + float A, float B, + int thetaRes, int phiRes); /* transform.c */ ! extern int limnObjectHomog(limnObject *obj, int space); ! extern int limnObjectNormals(limnObject *obj, int space); ! extern int limnObjectSpaceTransform(limnObject *obj, limnCamera *cam, ! limnWindow *win, int space); ! extern int limnObjectPartTransform(limnObject *obj, int ri, float tx[16]); ! extern int limnObjectDepthSortParts(limnObject *obj); ! extern int limnObjectDepthSortFaces(limnObject *obj); /* renderLimn.c */ ! extern int limnObjectRender(limnObject *obj, limnCamera *cam, limnWindow *win); ! extern int limnObjectPSDraw(limnObject *obj, limnCamera *cam, ! Nrrd *envMap, limnWindow *win); ! extern int limnObjectPSDrawConcave(limnObject *obj, limnCamera *cam, ! Nrrd *envMap, limnWindow *win); /* splineMethods.c */ Index: methodsLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/methodsLimn.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** methodsLimn.c 9 Feb 2004 07:06:18 -0000 1.10 --- methodsLimn.c 9 Feb 2004 22:48:01 -0000 1.11 *************** *** 79,90 **** ps->lineWidth[limnEdgeTypeBorder] = 1.0; ps->lineWidth[limnEdgeTypeLone] = 1.0; - ps->haloWidth[limnEdgeTypeUnknown] = AIR_NAN; - ps->haloWidth[limnEdgeTypeBackFacet] = 0.0; - ps->haloWidth[limnEdgeTypeBackCrease] = 0.0; - ps->haloWidth[limnEdgeTypeContour] = 0.0; - ps->haloWidth[limnEdgeTypeFrontCrease] = 0.0; - ps->haloWidth[limnEdgeTypeFrontFacet] = 0.0; - ps->haloWidth[limnEdgeTypeBorder] = 0.0; - ps->haloWidth[limnEdgeTypeLone] = 0.0; ps->creaseAngle = 46; ps->showpage = AIR_FALSE; --- 79,82 ---- *************** *** 93,101 **** } ! limnWin * ! limnWinNew(int device) { ! limnWin *win; ! win = (limnWin *)calloc(1, sizeof(limnWin)); if (win) { win->device = device; --- 85,93 ---- } ! limnWindow * ! limnWindowNew(int device) { ! limnWindow *win; ! win = (limnWindow *)calloc(1, sizeof(limnWindow)); if (win) { win->device = device; *************** *** 112,117 **** } ! limnWin * ! limnWinNix(limnWin *win) { if (win) { --- 104,109 ---- } ! limnWindow * ! limnWindowNix(limnWindow *win) { if (win) { Index: obj.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/obj.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** obj.c 9 Feb 2004 07:06:18 -0000 1.15 --- obj.c 9 Feb 2004 22:48:01 -0000 1.16 *************** *** 21,67 **** #include "limn.h" ! limnObj * ! limnObjNew(int incr, int edges) { ! limnObj *obj; ! obj = (limnObj *)calloc(1, sizeof(limnObj)); ! obj->p = NULL; ! obj->v = NULL; ! obj->e = NULL; ! obj->f = NULL; ! obj->fSort = NULL; ! obj->r = NULL; ! obj->s = NULL; /* create all various airArrays */ ! obj->pA = airArrayNew((void**)&(obj->p), NULL, ! sizeof(limnPoint), incr); ! obj->vA = airArrayNew((void**)&(obj->v), NULL, ! sizeof(int), incr); ! obj->eA = airArrayNew((void**)&(obj->e), NULL, ! sizeof(limnEdge), incr); ! obj->fA = airArrayNew((void**)&(obj->f), NULL, ! sizeof(limnFace), incr); ! obj->rA = airArrayNew((void**)&(obj->r), NULL, ! sizeof(limnPart), incr); ! obj->sA = airArrayNew((void**)&(obj->s), NULL, ! sizeof(limnSP), incr); ! obj->rCurr = NULL; ! obj->edges = edges; return obj; } ! limnObj * ! limnObjNix(limnObj *obj) { ! airArrayNuke(obj->pA); ! airArrayNuke(obj->vA); ! airArrayNuke(obj->eA); ! airArrayNuke(obj->fA); ! airFree(obj->fSort); ! airArrayNuke(obj->rA); ! airArrayNuke(obj->sA); free(obj); return NULL; --- 21,80 ---- #include "limn.h" ! int ! limnObjectLookAdd(limnObject *obj) { ! int lookIdx; ! limnLook *look; ! lookIdx = airArrayIncrLen(obj->lookArr, 1); ! look = &(obj->look[lookIdx]); ! ELL_4V_SET(look->rgba, 1, 1, 1, 1); ! ELL_3V_SET(look->kads, 0.5, 0.5, 0.0); ! look->spow = 50; ! return lookIdx; ! } ! ! ! limnObject * ! limnObjectNew(int incr, int doEdges) { ! limnObject *obj; ! ! obj = (limnObject *)calloc(1, sizeof(limnObject)); ! obj->vert = NULL; ! obj->edge = NULL; ! obj->face = NULL; ! obj->faceSort = NULL; ! obj->part = NULL; ! obj->look = NULL; /* create all various airArrays */ ! obj->vertArr = airArrayNew((void**)&(obj->vert), &(obj->vertNum), ! sizeof(limnVertex), incr); ! obj->edgeArr = airArrayNew((void**)&(obj->edge), &(obj->edgeNum), ! sizeof(limnEdge), incr); ! obj->faceArr = airArrayNew((void**)&(obj->face), &(obj->faceNum), ! sizeof(limnFace), incr); ! obj->partArr = airArrayNew((void**)&(obj->part), &(obj->partNum), ! sizeof(limnPart), incr); ! obj->lookArr = airArrayNew((void**)&(obj->look), &(obj->lookNum), ! sizeof(limnLook), incr); ! /* create (default) look 0 */ ! limnObjectLookAdd(obj); ! ! obj->doEdges = doEdges; ! obj->incr = incr; return obj; } ! limnObject * ! limnObjectNix(limnObject *obj) { ! airArrayNuke(obj->vertArr); ! airArrayNuke(obj->edgeArr); ! airArrayNuke(obj->faceArr); ! airFree(obj->faceSort); ! airArrayNuke(obj->partArr); ! airArrayNuke(obj->lookArr); free(obj); return NULL; *************** *** 69,197 **** int ! limnObjPartStart(limnObj *obj) { ! int rBase; ! limnPart *r; ! rBase = airArrayIncrLen(obj->rA, 1); ! r = &(obj->r[rBase]); ! r->fBase = obj->fA->len; r->fNum = 0; ! r->eBase = obj->eA->len; r->eNum = 0; ! r->pBase = obj->pA->len; r->pNum = 0; ! r->origIdx = rBase; ! r->sp = 0; ! obj->rCurr = r; ! return rBase; } int ! limnObjPointAdd(limnObj *obj, int sp, float x, float y, float z) { ! limnPoint *p; ! int pBase; ! ! pBase = airArrayIncrLen(obj->pA, 1); ! p = &(obj->p[pBase]); ! ELL_4V_SET(p->w, x, y, z, 1); ! ELL_3V_SET(p->v, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(p->s, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(p->n, AIR_NAN, AIR_NAN, AIR_NAN); ! p->d[0] = p->d[1] = AIR_NAN; ! p->sp = sp; ! obj->rCurr->pNum++; ! return pBase; ! } ! void ! _limnEdgeInit(limnEdge *e, int sp, int face, int v0, int v1) { ! ! e->v0 = v0; ! e->v1 = v1; ! e->f0 = face; ! e->f1 = -1; ! e->sp = sp; ! e->type = limnEdgeTypeUnknown; } int ! limnObjEdgeAdd(limnObj *obj, int sp, int face, int v0, int v1) { ! int ret, t, i, eNum, eBase; ! limnEdge *e=NULL; ! ! eBase = obj->rCurr->eBase; ! eNum = obj->rCurr->eNum; ! if (v0 > v1) { ! ELL_SWAP2(v0, v1, t); } ! ! /* do a linear search through this part's edges */ ! for (i=0; i<=eNum-1; i++) { ! e = &(obj->e[eBase+i]); ! if (e->v0 == v0 && e->v1 == v1) { break; } } ! if (i == eNum) { ! /* edge not found */ ! eBase = airArrayIncrLen(obj->eA, 1); ! e = &(obj->e[eBase]); ! _limnEdgeInit(e, sp, face, v0, v1); ! ret = eBase; ! obj->rCurr->eNum++; ! } ! else { ! /* edge already exists */ ! e->f1 = face; ! ret = eBase+i; } ! return ret; } int ! limnObjFaceAdd(limnObj *obj, int sp, int numVert, int *vert) { ! int i, vBase, fBase; ! limnFace *f; ! fBase = airArrayIncrLen(obj->fA, 1); ! vBase = airArrayIncrLen(obj->vA, numVert); ! f = &(obj->f[fBase]); ! ELL_3V_SET(f->wn, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(f->sn, AIR_NAN, AIR_NAN, AIR_NAN); ! f->vBase = vBase; ! f->vNum = numVert; ! for (i=0; i<=numVert-1; i++) { ! obj->v[vBase + i] = vert[i]; ! if (obj->edges) { ! limnObjEdgeAdd(obj, 1, fBase, vert[i], vert[AIR_MOD(i+1, numVert)]); } } ! f->sp = sp; ! f->visib = AIR_FALSE; ! obj->rCurr->fNum++; ! ! return fBase; ! } ! ! int ! limnObjPartFinish(limnObj *obj) { ! ! obj->rCurr = NULL; ! return 0; } - int - limnObjSPAdd(limnObj *obj) { - int sBase; - limnSP *s; - - sBase = airArrayIncrLen(obj->sA, 1); - s = &(obj->s[sBase]); - ELL_4V_SET(s->rgba, 1, 1, 1, 1); - ELL_3V_SET(s->k, 0.5, 0.5, 0.0); - s->spec = 50; - return sBase; - } --- 82,208 ---- int ! limnObjectPartAdd(limnObject *obj) { ! int partIdx; ! limnPart *part; ! partIdx = airArrayIncrLen(obj->partArr, 1); ! part = obj->part + partIdx; ! part->vertIdx = NULL; ! part->edgeIdx = NULL; ! part->faceIdx = NULL; ! part->vertIdxArr = airArrayNew((void**)&(part->vertIdx), &(part->vertIdxNum), ! sizeof(int), obj->incr); ! part->edgeIdxArr = airArrayNew((void**)&(part->edgeIdx), &(part->edgeIdxNum), ! sizeof(int), obj->incr); ! part->faceIdxArr = airArrayNew((void**)&(part->faceIdx), &(part->faceIdxNum), ! sizeof(int), obj->incr); ! part->lookIdx = 0; ! part->depth = AIR_NAN; ! ! return partIdx; } int ! limnObjectVertexAdd(limnObject *obj, int partIdx, int lookIdx, ! float x, float y, float z) { ! limnPart *part; ! limnVertex *vert; ! int vertIdx, vertIdxIdx; ! part = obj->part + partIdx; ! vertIdx = airArrayIncrLen(obj->vertArr, 1); ! vert = obj->vert + vertIdx; ! vertIdxIdx = airArrayIncrLen(part->vertIdxArr, 1); ! part->vertIdx[vertIdxIdx] = vertIdx; ! ELL_4V_SET(vert->world, x, y, z, 1); ! ELL_3V_SET(vert->view, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(vert->screen, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(vert->worldNormal, AIR_NAN, AIR_NAN, AIR_NAN); ! vert->device[0] = vert->device[1] = AIR_NAN; ! vert->partIdx = partIdx; ! vert->lookIdx = lookIdx; ! return vertIdxIdx; } int ! limnObjectEdgeAdd(limnObject *obj, int partIdx, int lookIdx, ! int faceIdxIdx, int vertIdxIdx0, int vertIdxIdx1) { ! int tmp, edgeIdx, edgeIdxIdx; ! limnEdge *edge=NULL; ! limnPart *part; ! part = obj->part + partIdx; ! if (vertIdxIdx0 > vertIdxIdx1) { ! ELL_SWAP2(vertIdxIdx0, vertIdxIdx1, tmp); } ! ! /* do a linear search through this part's existing edges */ ! for (edgeIdxIdx=0; edgeIdxIdx<part->edgeIdxNum; edgeIdxIdx++) { ! edgeIdx = part->edgeIdx[edgeIdxIdx]; ! edge = &(obj->edge[edgeIdx]); ! if (edge->vertIdxIdx[0] == vertIdxIdx0 ! && edge->vertIdxIdx[1] == vertIdxIdx1) { break; } } ! if (edgeIdxIdx == part->edgeIdxNum) { ! /* edge not found, add it */ ! edgeIdx = airArrayIncrLen(obj->edgeArr, 1); ! edge = &(obj->edge[edgeIdx]); ! edgeIdxIdx = airArrayIncrLen(part->edgeIdxArr, 1); ! part->edgeIdx[edgeIdxIdx] = edgeIdx; ! edge->vertIdxIdx[0] = vertIdxIdx0; ! edge->vertIdxIdx[1] = vertIdxIdx1; ! edge->faceIdxIdx[0] = faceIdxIdx; ! edge->faceIdxIdx[1] = -1; ! edge->lookIdx = lookIdx; ! edge->partIdx = partIdx; ! edge->type = limnEdgeTypeUnknown; ! edge->once = AIR_FALSE; ! } else { ! /* edge already exists; "edge", "edgeIdx", and "edgeIdxIdx" are all set */ ! edge->faceIdxIdx[1] = faceIdxIdx; } ! return edgeIdxIdx; } int ! limnObjectFaceAdd(limnObject *obj, int partIdx, ! int lookIdx, int sideNum, int *vertIdxIdx) { ! limnFace *face; ! limnPart *part; ! int faceIdx, faceIdxIdx, sideIdx; ! part = obj->part + partIdx; ! faceIdx = airArrayIncrLen(obj->faceArr, 1); ! face = &(obj->face[faceIdx]); ! faceIdxIdx = airArrayIncrLen(part->faceIdxArr, 1); ! part->faceIdx[faceIdxIdx] = faceIdx; ! face->vertIdxIdx = (int*)calloc(sideNum, sizeof(int)); ! if (obj->doEdges) { ! face->edgeIdxIdx = (int*)calloc(sideNum, sizeof(int)); ! } ! face->sideNum = sideNum; ! for (sideIdx=0; sideIdx<sideNum; sideIdx++) { ! face->vertIdxIdx[sideIdx] = vertIdxIdx[sideIdx]; ! if (obj->doEdges) { ! face->edgeIdxIdx[sideIdx] = ! limnObjectEdgeAdd(obj, partIdx, 0, faceIdxIdx, ! vertIdxIdx[sideIdx], ! vertIdxIdx[AIR_MOD(sideIdx+1, sideNum)]); } } ! ELL_3V_SET(face->worldNormal, AIR_NAN, AIR_NAN, AIR_NAN); ! ELL_3V_SET(face->screenNormal, AIR_NAN, AIR_NAN, AIR_NAN); ! face->lookIdx = lookIdx; ! face->partIdx = partIdx; ! face->visible = AIR_FALSE; ! face->depth = AIR_NAN; ! return faceIdx; } Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** renderLimn.c 9 Feb 2004 07:06:18 -0000 1.16 --- renderLimn.c 9 Feb 2004 22:48:01 -0000 1.17 *************** *** 22,27 **** int ! limnObjRender(limnObj *obj, limnCamera *cam, limnWin *win) { ! char me[]="limnObjRender", err[AIR_STRLEN_MED]; int E; --- 22,27 ---- int ! limnObjectRender(limnObject *obj, limnCamera *cam, limnWindow *win) { ! char me[]="limnObjectRender", err[AIR_STRLEN_MED]; int E; *************** *** 32,41 **** fprintf(stderr, "%s: true right = %g %g %g\n", me, cam->U[0], cam->U[1], cam->U[2]); ! if (!E) E |= limnObjHomog(obj, limnSpaceWorld); ! if (!E) E |= limnObjNormals(obj, limnSpaceWorld); ! if (!E) E |= limnObjSpaceTransform(obj, cam, win, limnSpaceView); ! if (!E) E |= limnObjSpaceTransform(obj, cam, win, limnSpaceScreen); ! if (!E) E |= limnObjSpaceTransform(obj, cam, win, limnSpaceDevice); ! if (!E) E |= limnObjNormals(obj, limnSpaceScreen); if (E) { sprintf(err, "%s: trouble", me); --- 32,41 ---- fprintf(stderr, "%s: true right = %g %g %g\n", me, cam->U[0], cam->U[1], cam->U[2]); ! if (!E) E |= limnObjectHomog(obj, limnSpaceWorld); ! if (!E) E |= limnObjectNormals(obj, limnSpaceWorld); ! if (!E) E |= limnObjectSpaceTransform(obj, cam, win, limnSpaceView); ! if (!E) E |= limnObjectSpaceTransform(obj, cam, win, limnSpaceScreen); ! if (!E) E |= limnObjectSpaceTransform(obj, cam, win, limnSpaceDevice); ! if (!E) E |= limnObjectNormals(obj, limnSpaceScreen); if (E) { sprintf(err, "%s: trouble", me); *************** *** 46,50 **** void ! _limnPSPreamble(limnObj *obj, limnCamera *cam, limnWin *win) { fprintf(win->file, "%%!PS-Adobe-2.0 EPSF-2.0\n"); --- 46,50 ---- void ! _limnPSPreamble(limnObject *obj, limnCamera *cam, limnWindow *win) { fprintf(win->file, "%%!PS-Adobe-2.0 EPSF-2.0\n"); *************** *** 83,87 **** void ! _limnPSEpilogue(limnObj *obj, limnCamera *cam, limnWin *win) { fprintf(win->file, "grestore\n"); --- 83,87 ---- void ! _limnPSEpilogue(limnObject *obj, limnCamera *cam, limnWindow *win) { fprintf(win->file, "grestore\n"); *************** *** 94,141 **** void ! _limnPSDrawFace(limnObj *obj, limnPart *r, limnFace *f, ! limnCamera *cam, Nrrd *nmap, limnWin *win) { ! int vi; ! limnPoint *p; ! limnSP *sp; int qn; float *map, R, G, B; ! for (vi=0; vi<f->vNum; vi++) { ! p = obj->p + obj->v[vi + f->vBase]; fprintf(win->file, "%g %g %s\n", ! p->d[0], p->d[1], vi ? "L" : "M"); } ! sp = obj->s + f->sp; ! /* ! fprintf(stderr, "RGB = %g %g %g ->", r->rgba[0], r->rgba[1], r->rgba[2]); ! */ ! R = sp->k[0]*sp->rgba[0]; ! G = sp->k[0]*sp->rgba[1]; ! B = sp->k[0]*sp->rgba[2]; ! /* ! fprintf(stderr, "RGB = %g %g %g ->", R, G, B); ! */ if (nmap) { ! qn = limnVtoQN_f[limnQN16checker](f->wn); map = nmap->data; ! R += sp->k[1]*sp->rgba[0]*map[0 + 3*qn]; ! G += sp->k[1]*sp->rgba[1]*map[1 + 3*qn]; ! B += sp->k[1]*sp->rgba[2]*map[2 + 3*qn]; } else { ! R += sp->k[1]*sp->rgba[0]; ! G += sp->k[1]*sp->rgba[1]; ! B += sp->k[1]*sp->rgba[2]; } /* HEY: not evaluating phong specular for now */ - /* - fprintf(stderr, "%g %g %g ->", R, G, B); - */ R = AIR_CLAMP(0, R, 1); G = AIR_CLAMP(0, G, 1); B = AIR_CLAMP(0, B, 1); - /* - fprintf(stderr, "%g %g %g\n", R, G, B); - */ if (R == G && G == B) { fprintf(win->file, "CP %g Gr F\n", R); --- 94,131 ---- void ! _limnPSDrawFace(limnObject *obj, limnFace *face, ! limnCamera *cam, Nrrd *nmap, limnWindow *win) { ! int vii; ! limnVertex *vert; ! limnLook *look; ! limnPart *part; int qn; float *map, R, G, B; ! look = obj->look + face->lookIdx; ! part = obj->part + face->partIdx; ! for (vii=0; vii<face->sideNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; fprintf(win->file, "%g %g %s\n", ! vert->device[0], vert->device[1], vii ? "L" : "M"); } ! R = look->kads[0]*look->rgba[0]; ! G = look->kads[0]*look->rgba[1]; ! B = look->kads[0]*look->rgba[2]; if (nmap) { ! qn = limnVtoQN_f[limnQN16checker](face->worldNormal); map = nmap->data; ! R += look->kads[1]*look->rgba[0]*map[0 + 3*qn]; ! G += look->kads[1]*look->rgba[1]*map[1 + 3*qn]; ! B += look->kads[1]*look->rgba[2]*map[2 + 3*qn]; } else { ! R += look->kads[1]*look->rgba[0]; ! G += look->kads[1]*look->rgba[1]; ! B += look->kads[1]*look->rgba[2]; } /* HEY: not evaluating phong specular for now */ R = AIR_CLAMP(0, R, 1); G = AIR_CLAMP(0, G, 1); B = AIR_CLAMP(0, B, 1); if (R == G && G == B) { fprintf(win->file, "CP %g Gr F\n", R); *************** *** 147,160 **** void ! _limnPSDrawEdge(limnObj *obj, limnPart *r, limnEdge *e, ! limnCamera *cam, limnWin *win) { ! limnPoint *p0, *p1; ! if (win->ps.lineWidth[e->type]) { ! p0 = obj->p + e->v0; ! p1 = obj->p + e->v1; ! fprintf(win->file, "%g %g M ", p0->d[0], p0->d[1]); ! fprintf(win->file, "%g %g L ", p1->d[0], p1->d[1]); ! fprintf(win->file, "%g W ", win->ps.lineWidth[e->type]); fprintf(win->file, "S\n"); } --- 137,152 ---- void ! _limnPSDrawEdge(limnObject *obj, limnEdge *edge, ! limnCamera *cam, limnWindow *win) { ! limnVertex *vert0, *vert1; ! limnPart *part; ! part = obj->part + edge->partIdx; ! if (win->ps.lineWidth[edge->type]) { ! vert0 = obj->vert + part->vertIdx[edge->vertIdxIdx[0]]; ! vert1 = obj->vert + part->vertIdx[edge->vertIdxIdx[1]]; ! fprintf(win->file, "%g %g M ", vert0->device[0], vert0->device[1]); ! fprintf(win->file, "%g %g L ", vert1->device[0], vert1->device[1]); ! fprintf(win->file, "%g W ", win->ps.lineWidth[edge->type]); fprintf(win->file, "S\n"); } *************** *** 162,169 **** /* ! ******** limnObjPSDrawOld ** ** draws a "rendered" limn object to postscript. ! ** limnObjRender MUST be called first. ** ** The current (feeble) justification for using an environment map is --- 154,161 ---- /* ! ******** limnObjectPSDraw ** ** draws a "rendered" limn object to postscript. ! ** limnObjectRender MUST be called first. ** ** The current (feeble) justification for using an environment map is *************** *** 173,184 **** */ int ! limnObjPSDrawOld(limnObj *obj, limnCamera *cam, Nrrd *nmap, limnWin *win) { ! char me[]="limnObjPSDraw", err[AIR_STRLEN_MED]; int inside; float angle; ! limnFace *f, *f0, *f1; int fi; ! limnEdge *e; int ei; ! limnPart *r; int ri; ! limnPoint *p; int pi; if (nmap) { --- 165,177 ---- */ int ! limnObjectPSDraw(limnObject *obj, limnCamera *cam, ! Nrrd *nmap, limnWindow *win) { ! char me[]="limnObjectPSDraw", err[AIR_STRLEN_MED]; int inside; float angle; ! limnFace *face, *face0, *face1; int fii; ! limnEdge *edge; int eii; ! limnPart *part; int partIdx; ! limnVertex *vert; int vii; if (nmap) { *************** *** 189,216 **** } ! limnObjDepthSortParts(obj); _limnPSPreamble(obj, cam, win); ! for (ri=0; ri<obj->rA->len; ri++) { ! r = &(obj->r[ri]); /* only draw the parts that are inside the field of view */ inside = 0; ! for (pi=0; pi<r->pNum; pi++) { ! p = &(obj->p[r->pBase + pi]); ! /* ! printf("p[%d] = %g %g\n", pi, p->d[0], p->d[1]); ! */ ! inside |= (AIR_IN_CL(win->bbox[0], p->d[0], win->bbox[2]) && ! AIR_IN_CL(win->bbox[1], p->d[1], win->bbox[3])); ! if (inside) break; } ! if (!inside) continue; /* draw the part */ ! if (1 == r->eNum) { /* this part is just one lone edge */ /* HEY: this is a mess */ --- 182,210 ---- } ! limnObjectDepthSortParts(obj); _limnPSPreamble(obj, cam, win); ! for (partIdx=0; partIdx<obj->partNum; partIdx++) { ! part = obj->part + partIdx; /* only draw the parts that are inside the field of view */ inside = 0; ! for (vii=0; vii<part->vertIdxNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; ! inside |= (AIR_IN_CL(win->bbox[0], vert->device[0], win->bbox[2]) && ! AIR_IN_CL(win->bbox[1], vert->device[1], win->bbox[3])); ! if (inside) { ! /* at least vertex is in, we know we can't skip this part */ break; + } } ! if (!inside) { ! /* none of the vertices were in, we can skip this part */ continue; + } /* draw the part */ ! if (1 == part->edgeIdxNum) { /* this part is just one lone edge */ /* HEY: this is a mess */ *************** *** 223,229 **** fprintf(win->file, "%g %g %g RGB\n", r->rgba[0], r->rgba[1], r->rgba[2]); ! win->ps.edgeWidth[e->visib] = 4; _limnPSDrawEdge(obj, r, e, cam, win); ! win->ps.edgeWidth[e->visib] = widthTmp; */ } else { --- 217,223 ---- fprintf(win->file, "%g %g %g RGB\n", r->rgba[0], r->rgba[1], r->rgba[2]); ! win->ps.edgeWidth[e->visible] = 4; _limnPSDrawEdge(obj, r, e, cam, win); ! win->ps.edgeWidth[e->visible] = widthTmp; */ } else { *************** *** 231,251 **** /* draw the front-facing, shaded faces */ ! for (fi=0; fi<r->fNum; fi++) { ! f = &(obj->f[r->fBase + fi]); ! /* ! printf("f[%d]->sn = %g %g %g\n", fi, f->sn[0], f->sn[1], f->sn[2]); ! */ /* The consequence of having a left-handed frame is that world-space CC-wise vertex traversal becomes C-wise screen-space traversal, so all the normals are backwards of what we want */ ! f->visib = (cam->rightHanded ! ? f->sn[2] < 0 ! : f->sn[2] > 0); ! if (f->vNum == r->pNum && !f->visib) { ! f->visib = AIR_TRUE; ! ELL_3V_SCALE(f->wn, -1, f->wn); } ! if (!win->ps.wireFrame && f->visib) { ! _limnPSDrawFace(obj, r, f, cam, nmap, win); } } --- 225,243 ---- /* draw the front-facing, shaded faces */ ! for (fii=0; fii<part->faceIdxNum; fii++) { ! face = obj->face + part->faceIdx[fii]; /* The consequence of having a left-handed frame is that world-space CC-wise vertex traversal becomes C-wise screen-space traversal, so all the normals are backwards of what we want */ ! face->visible = (cam->rightHanded ! ? face->screenNormal[2] < 0 ! : face->screenNormal[2] > 0); ! if (face->sideNum == part->vertIdxNum && !face->visible) { ! /* lone faces are always visible */ ! face->visible = AIR_TRUE; ! ELL_3V_SCALE(face->worldNormal, -1, face->worldNormal); } ! if (!win->ps.wireFrame && face->visible) { ! _limnPSDrawFace(obj, face, cam, nmap, win); } } *************** *** 253,277 **** /* draw ALL edges */ fprintf(win->file, "0 setgray\n"); ! for (ei=0; ei<r->eNum; ei++) { ! e = &(obj->e[r->eBase + ei]); ! f0 = &(obj->f[e->f0]); ! f1 = e->f1 != -1 ? &(obj->f[e->f1]) : NULL; ! if (!f1) { ! e->type = limnEdgeTypeBorder; } else { ! angle = 180/M_PI*acos(ELL_3V_DOT(f0->wn, f1->wn)); ! if (f0->visib && f1->visib) { ! e->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeFrontCrease ! : limnEdgeTypeFrontFacet); ! } else if (f0->visib ^ f1->visib) { ! e->type = limnEdgeTypeContour; } else { ! e->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeBackCrease ! : limnEdgeTypeBackFacet); } } ! _limnPSDrawEdge(obj, r, e, cam, win); } } --- 245,272 ---- /* draw ALL edges */ fprintf(win->file, "0 setgray\n"); ! for (eii=0; eii<part->edgeIdxNum; eii++) { ! edge = obj->edge + part->edgeIdx[eii]; ! face0 = obj->face + part->faceIdx[edge->faceIdxIdx[0]]; ! face1 = (-1 == edge->faceIdxIdx[0] ! ? NULL ! : obj->face + part->faceIdx[edge->faceIdxIdx[1]]); ! if (!face1) { ! edge->type = limnEdgeTypeBorder; } else { ! angle = 180/M_PI*acos(ELL_3V_DOT(face0->worldNormal, ! face1->worldNormal)); ! if (face0->visible && face1->visible) { ! edge->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeFrontCrease ! : limnEdgeTypeFrontFacet); ! } else if (face0->visible ^ face1->visible) { ! edge->type = limnEdgeTypeContour; } else { ! edge->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeBackCrease ! : limnEdgeTypeBackFacet); } } ! _limnPSDrawEdge(obj, edge, cam, win); } } *************** *** 283,323 **** } - void - _limnPSDrawPointPair(limnObj *obj, limnPart *r, - int v0, int v1, int type, - limnCamera *cam, limnWin *win) { - - if (win->ps.lineWidth[type]) { - fprintf(win->file, "%g %g M ", obj->p[v0].d[0], obj->p[v0].d[1]); - fprintf(win->file, "%g %g L ", obj->p[v1].d[0], obj->p[v1].d[1]); - fprintf(win->file, "%g W ", win->ps.lineWidth[type]); - fprintf(win->file, "S\n"); - } - } - /* ! ** HEY: drawing non-convex objects has to be done one face at a time, ! ** and faces are responsible for drawing their edges. The STUPID ! ** thing about limn right now is that faces do not have a list of ! ** their edges; only a list of their vertex indices... ! */ ! ! /* ! ******** limnObjPSDraw ** ! ** new version of the above, which works per-face instead of per-part */ int ! limnObjPSDraw(limnObj *obj, limnCamera *cam, Nrrd *nmap, limnWin *win) { ! char me[]="limnObjPSDraw", err[AIR_STRLEN_MED]; ! int inside, vi, psize, v0, v1; float angle; ! limnFace *f, *f0, *f1; int fi; ! limnEdge *e; int ei; ! limnPart *r; int ri; ! limnPoint *p; int pi; ! Nrrd *neinfo; ! unsigned char *einfo; ! airArray *mop; if (nmap) { --- 278,296 ---- } /* ! ******** limnObjectPSDrawConcave ** ! ** new version of the above, which works per-face instead of per-part, ! ** thus better handling self-occlusions, but at the cost of not getting ! ** contours near oblique faces correct... */ int ! limnObjectPSDrawConcave(limnObject *obj, limnCamera *cam, ! Nrrd *nmap, limnWindow *win) { ! char me[]="limnObjectPSDrawConcave", err[AIR_STRLEN_MED]; float angle; ! limnPart *part; ! limnFace *face, *face0, *face1; int faceIdx; ! limnEdge *edge; int edgeIdx, eii; if (nmap) { *************** *** 328,397 **** } ! mop = airMopNew(); ! neinfo = nrrdNew(); ! airMopAdd(mop, neinfo, (airMopper)nrrdNuke, airMopAlways); ! psize = obj->pA->len; ! if (nrrdMaybeAlloc(neinfo, nrrdTypeUChar, 2, psize, psize)) { ! sprintf(err, "%s: couldn't allocate %d x %d array of point pairs", ! me, obj->pA->len, obj->pA->len); ! biffMove(LIMN, err, NRRD); return 1; ! } ! einfo = (unsigned char*)(neinfo->data); ! ! limnObjDepthSortFaces(obj); _limnPSPreamble(obj, cam, win); ! ! /* categorize all edges by traversing edge array, and storing ! edge type information in einfo[] */ ! for (ei=0; ei<obj->eA->len; ei++) { ! e = obj->e + ei; ! if (e->v0 < e->v1) { ! v0 = e->v0; ! v1 = e->v1; ! } else { ! v0 = e->v1; ! v1 = e->v0; } ! f0 = &(obj->f[e->f0]); ! f1 = e->f1 != -1 ? &(obj->f[e->f1]) : NULL; ! if (!f1) { ! einfo[v0 + psize*v1] = limnEdgeTypeBorder; } else { ! angle = 180/M_PI*acos(ELL_3V_DOT(f0->wn, f1->wn)); ! if (f0->visib && f1->visib) { ! einfo[v0 + psize*v1] = (angle > win->ps.creaseAngle ! ? limnEdgeTypeFrontCrease ! : limnEdgeTypeFrontFacet); ! } else if (f0->visib ^ f1->visib) { ! einfo[v0 + psize*v1] = limnEdgeTypeContour; } else { ! einfo[v0 + psize*v1] = (angle > win->ps.creaseAngle ! ? limnEdgeTypeBackCrease ! : limnEdgeTypeBackFacet); } } } ! /* draw front-faces and non-back edges */ ! for (fi=0; fi<obj->fA->len; fi++) { ! f = obj->f + obj->fSort[fi]; ! f->visib = (cam->rightHanded ! ? f->sn[2] < 0 ! : f->sn[2] > 0); ! if (f->vNum == r->pNum && !f->visib) { ! f->visib = AIR_TRUE; ! ELL_3V_SCALE(f->wn, -1, f->wn); } ! if (!win->ps.wireFrame && f->visib) { ! _limnPSDrawFace(obj, r, f, cam, nmap, win); } ! /* ! for (vi=0; vi<f->vNum; vi++) { ! p = obj->p + obj->v[vi + f->vBase]; ! fprintf(win->file, "%g %g %s\n", ! p->d[0], p->d[1], vi ? "L" : "M"); } - */ } --- 301,379 ---- } ! limnObjectDepthSortFaces(obj); _limnPSPreamble(obj, cam, win); ! ! /* set every face's visibility */ ! for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->face + faceIdx; ! part = obj->part + face->partIdx; ! face->visible = (cam->rightHanded ! ? face->screenNormal[2] < 0 ! : face->screenNormal[2] > 0); ! if (face->sideNum == part->vertIdxNum && !face->visible) { ! /* lone faces are always visible */ ! face->visible = AIR_TRUE; ! ELL_3V_SCALE(face->worldNormal, -1, face->worldNormal); } ! } ! ! /* categorize all edges by traversing edge array, and looking ! at each of their two faces */ ! for (edgeIdx=0; edgeIdx<obj->edgeNum; edgeIdx++) { ! edge = obj->edge + edgeIdx; ! part = obj->part + edge->partIdx; ! face0 = obj->face + part->faceIdx[edge->faceIdxIdx[0]]; ! face1 = (-1 == edge->faceIdxIdx[1] ! ? NULL ! : obj->face + part->faceIdx[edge->faceIdxIdx[1]]); ! if (!face1) { ! edge->type = limnEdgeTypeBorder; } else { ! angle = 180/M_PI*acos(ELL_3V_DOT(face0->worldNormal, ! face1->worldNormal)); ! if (face0->visible && face1->visible) { ! edge->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeFrontCrease ! : limnEdgeTypeFrontFacet); ! } else if (face0->visible ^ face1->visible) { ! edge->type = limnEdgeTypeContour; } else { ! edge->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeBackCrease ! : limnEdgeTypeBackFacet); } } } ! /* draw front-faces and their edges ! (contours, front crease, front non-crease) */ ! for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->face + obj->faceSort[faceIdx]; ! part = obj->part + face->partIdx; ! if (!face->visible) { ! continue; } ! if (!win->ps.wireFrame) { ! _limnPSDrawFace(obj, face, cam, nmap, win); } ! /* draw those edges around the face that won't be seen again by ! future faces in the depth-first traversal */ ! for (eii=0; eii<face->sideNum; eii++) { ! edge = obj->edge + part->edgeIdx[face->edgeIdxIdx[eii]]; ! if (limnEdgeTypeContour == edge->type) { ! _limnPSDrawEdge(obj, edge, cam, win); ! } else if (limnEdgeTypeFrontCrease == edge->type ! || limnEdgeTypeFrontFacet == edge->type) { ! if (edge->once) { ! /* its been seen once already, okay to draw */ ! _limnPSDrawEdge(obj, edge, cam, win); ! edge->once = AIR_FALSE; ! } else { ! /* we're the first to see it, and we're not the last, don't draw */ ! edge->once = AIR_TRUE; ! } ! } } } Index: shapes.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/shapes.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shapes.c 7 Jan 2004 15:34:30 -0000 1.15 --- shapes.c 9 Feb 2004 22:48:01 -0000 1.16 *************** *** 22,29 **** int ! limnObjCubeAdd(limnObj *obj, int sp) { ! int pb, v[4], ret; ! ret = limnObjPartStart(obj); /* 7 6 --- 22,29 ---- int ! limnObjectCubeAdd(limnObject *obj, int lookIdx) { ! int vII[4], vII0, partIdx; ! partIdx = limnObjectPartAdd(obj); /* 7 6 *************** *** 36,90 **** ------ x */ ! pb = limnObjPointAdd(obj, 0, -1, -1, -1); ! limnObjPointAdd(obj, 0, 1, -1, -1); ! limnObjPointAdd(obj, 0, 1, 1, -1); ! limnObjPointAdd(obj, 0, -1, 1, -1); ! limnObjPointAdd(obj, 0, -1, -1, 1); ! limnObjPointAdd(obj, 0, 1, -1, 1); ! limnObjPointAdd(obj, 0, 1, 1, 1); ! limnObjPointAdd(obj, 0, -1, 1, 1); ! ELL_4V_SET(v, pb+3, pb+2, pb+1, pb+0); limnObjFaceAdd(obj, sp, 4, v); ! ELL_4V_SET(v, pb+1, pb+5, pb+4, pb+0); limnObjFaceAdd(obj, sp, 4, v); ! ELL_4V_SET(v, pb+2, pb+6, pb+5, pb+1); limnObjFaceAdd(obj, sp, 4, v); ! ELL_4V_SET(v, pb+3, pb+7, pb+6, pb+2); limnObjFaceAdd(obj, sp, 4, v); ! ELL_4V_SET(v, pb+0, pb+4, pb+7, pb+3); limnObjFaceAdd(obj, sp, 4, v); ! ELL_4V_SET(v, pb+5, pb+6, pb+7, pb+4); limnObjFaceAdd(obj, sp, 4, v); ! limnObjPartFinish(obj); ! ! return ret; ! } ! ! int ! limnObjSquareAdd(limnObj *obj, int sp) { ! int pb, v[4], ret; ! ! ret = limnObjPartStart(obj); ! pb = limnObjPointAdd(obj, 0, 0, 0, 0); ! limnObjPointAdd(obj, 0, 1, 0, 0); ! limnObjPointAdd(obj, 0, 1, 1, 0); ! limnObjPointAdd(obj, 0, 0, 1, 0); ! ELL_4V_SET(v, pb+0, pb+1, pb+2, pb+3); limnObjFaceAdd(obj, sp, 4, v); ! limnObjPartFinish(obj); ! return ret; } int ! limnObjLoneEdgeAdd(limnObj *obj, int sp) { ! int pb, ret; ! float x; ! x = 0.5; ! ret = limnObjPartStart(obj); ! pb = limnObjPointAdd(obj, 0, -x, 0, 0); ! limnObjPointAdd(obj, 0, x, 0, 0); ! limnObjEdgeAdd(obj, 1, -1, pb+0, pb+1); ! limnObjPartFinish(obj); ! return ret; } /* ! ******** limnObjCylinderAdd ** ** adds a cylinder that fills up the bi-unit cube [-1,1]^3, --- 36,80 ---- ------ x */ ! vII0 = limnObjectVertexAdd(obj, partIdx, 0, -1, -1, -1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, -1, -1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, 1, -1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, -1, 1, -1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, -1, -1, 1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, -1, 1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, 1, 1); ! limnObjectVertexAdd(obj, partIdx, lookIdx, -1, 1, 1); ! ELL_4V_SET(vII, vII0+3, vII0+2, vII0+1, vII0+0); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! ELL_4V_SET(vII, vII0+1, vII0+5, vII0+4, vII0+0); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! ELL_4V_SET(vII, vII0+2, vII0+6, vII0+5, vII0+1); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! ELL_4V_SET(vII, vII0+3, vII0+7, vII0+6, vII0+2); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! ELL_4V_SET(vII, vII0+0, vII0+4, vII0+7, vII0+3); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! ELL_4V_SET(vII, vII0+5, vII0+6, vII0+7, vII0+4); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! return partIdx; } int ! limnObjectSquareAdd(limnObject *obj, int lookIdx) { ! int vII0, vII[4], partIdx; ! partIdx = limnObjectPartAdd(obj); ! vII0 = limnObjectVertexAdd(obj, partIdx, lookIdx, 0, 0, 0); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, 0, 0); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 1, 1, 0); ! limnObjectVertexAdd(obj, partIdx, lookIdx, 0, 1, 0); ! ELL_4V_SET(vII, vII0+0, vII0+1, vII0+2, vII0+3); ! limnObjectFaceAdd(obj, partIdx, lookIdx, 4, vII); ! return partIdx; } /* ! ******** limnObjectCylinderAdd ** ** adds a cylinder that fills up the bi-unit cube [-1,1]^3, *************** *** 92,142 **** */ int ! limnObjCylinderAdd(limnObj *obj, int sp, int axis, int res) { ! float th; ! int i, j, t, pb=-1, ret, *v; ! ret = limnObjPartStart(obj); ! v = (int *)calloc(res, sizeof(int)); ! for (i=0; i<=res-1; i++) { ! th = AIR_AFFINE(0, i, res, 0, 2*M_PI); switch(axis) { case 0: ! t = limnObjPointAdd(obj, 0, 1, -sin(th), cos(th)); if (!i) pb = t; ! limnObjPointAdd(obj, 0, -1, -sin(th), cos(th)); break; case 1: ! t = limnObjPointAdd(obj, 0, sin(th), 1, cos(th)); if (!i) pb = t; ! limnObjPointAdd(obj, 0, sin(th), -1, cos(th)); break; case 2: default: ! t = limnObjPointAdd(obj, 0, cos(th), sin(th), 1); if (!i) pb = t; ! limnObjPointAdd(obj, 0, cos(th), sin(th), -1); break; } } ! for (i=0; i<=res-1; i++) { ! j = (i+1) % res; ! ELL_4V_SET(v, pb + 2*i, pb + 2*i + 1, pb + 2*j + 1, pb + 2*j); ! limnObjFaceAdd(obj,... [truncated message content] |
|
From: <kin...@us...> - 2004-02-10 01:53:54
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24821/test Modified Files: off2eps.c Log Message: sorry, still debugging Index: off2eps.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/off2eps.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** off2eps.c 9 Feb 2004 22:48:01 -0000 1.2 --- off2eps.c 9 Feb 2004 23:47:32 -0000 1.3 *************** *** 35,39 **** Nrrd *nmap; FILE *file; ! int wire, concave; mop = airMopNew(); --- 35,39 ---- Nrrd *nmap; FILE *file; ! int wire, concave, describe; mop = airMopNew(); *************** *** 68,71 **** --- 68,73 ---- "use slightly buggy rendering method suitable for " "concave or self-occluding objects"); + hestOptAdd(&hopt, "describe", NULL, airTypeInt, 0, 0, &describe, NULL, + "for debugging: list object definition of OFF read"); hestOptAdd(&hopt, "wd", "5 widths", airTypeFloat, 5, 5, edgeWidth, "0.0 0.0 3.0 2.0 0.0", *************** *** 97,101 **** if (!(file = airFopen(inS, stdin, "r"))) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS); ! return 1; } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); --- 99,103 ---- if (!(file = airFopen(inS, stdin, "r"))) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS); ! airMopError(mop); return 1; } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); *************** *** 110,114 **** airMopError(mop); return 1; } - win = limnWindowNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; --- 112,115 ---- *************** *** 135,138 **** --- 136,143 ---- fclose(win->file); + if (describe) { + limnObjectDescribe(stdout, obj); + } + airMopOkay(mop); return 0; |
|
From: <kin...@us...> - 2004-02-10 01:26:55
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24821 Modified Files: io.c obj.c renderLimn.c Log Message: sorry, still debugging Index: io.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/io.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** io.c 9 Feb 2004 22:48:01 -0000 1.9 --- io.c 9 Feb 2004 23:47:32 -0000 1.10 *************** *** 27,30 **** --- 27,31 ---- limnVertex *vert; int vii; limnPart *part; int partIdx; + limnLook *look; fprintf(file, "parts: %d\n", obj->partNum); *************** *** 34,40 **** for (vii=0; vii<part->vertIdxNum; vii++) { vert = obj->vert + part->vertIdx[vii]; ! fprintf(file, "part %d | %d(%d): " "w=(%g,%g,%g)\tv=(%g,%g,%g)\ts(%g,%g,%g)\n", ! partIdx, vii, part->vertIdx[vii], vert->world[0], vert->world[1], vert->world[2], vert->view[0], vert->view[1], vert->view[2], --- 35,41 ---- for (vii=0; vii<part->vertIdxNum; vii++) { vert = obj->vert + part->vertIdx[vii]; ! fprintf(file, "part %d==%d | %d(%d): " "w=(%g,%g,%g)\tv=(%g,%g,%g)\ts(%g,%g,%g)\n", ! partIdx, vert->partIdx, vii, part->vertIdx[vii], vert->world[0], vert->world[1], vert->world[2], vert->view[0], vert->view[1], vert->view[2], *************** *** 44,50 **** for (eii=0; eii<part->edgeIdxNum; eii++) { edge = obj->edge + part->edgeIdx[eii]; ! fprintf(file, "part %d | %d(%d): " "vert(%d,%d), face(%d,%d)\n", ! partIdx, eii, part->edgeIdx[eii], edge->vertIdxIdx[0], edge->vertIdxIdx[1], edge->faceIdxIdx[0], edge->faceIdxIdx[1]); --- 45,51 ---- for (eii=0; eii<part->edgeIdxNum; eii++) { edge = obj->edge + part->edgeIdx[eii]; ! fprintf(file, "part %d==%d | %d(%d): " "vert(%d,%d), face(%d,%d)\n", ! partIdx, edge->partIdx, eii, part->edgeIdx[eii], edge->vertIdxIdx[0], edge->vertIdxIdx[1], edge->faceIdxIdx[0], edge->faceIdxIdx[1]); *************** *** 53,57 **** for (fii=0; fii<part->faceIdxNum; fii++) { face = obj->face + part->faceIdx[fii]; ! fprintf(file, "part %d | %d(%d): [", partIdx, fii, part->faceIdx[fii]); for (si=0; si<face->sideNum; si++) { fprintf(file, "%d", part->vertIdx[face->vertIdxIdx[si]]); --- 54,59 ---- for (fii=0; fii<part->faceIdxNum; fii++) { face = obj->face + part->faceIdx[fii]; ! fprintf(file, "part %d==%d | %d(%d): [", ! partIdx, face->partIdx, fii, part->faceIdx[fii]); for (si=0; si<face->sideNum; si++) { fprintf(file, "%d", part->vertIdx[face->vertIdxIdx[si]]); *************** *** 59,64 **** fprintf(file, ","); } ! fprintf(file, "]; wn = (%g,%g,%g)\n", face->worldNormal[0], face->worldNormal[1], face->worldNormal[2]); } } --- 61,72 ---- fprintf(file, ","); } ! fprintf(file, "]; wn = (%g,%g,%g)", face->worldNormal[0], face->worldNormal[1], face->worldNormal[2]); + if (face->lookIdx) { + look = obj->look + face->lookIdx; + fprintf(file, "; RGB=(%g,%g,%g)", + look->rgba[0], look->rgba[1], look->rgba[2]); + } + fprintf(file, "\n"); } } Index: obj.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/obj.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** obj.c 9 Feb 2004 22:48:01 -0000 1.16 --- obj.c 9 Feb 2004 23:47:32 -0000 1.17 *************** *** 68,74 **** --- 68,102 ---- } + void + _limnObjectPartEmpty(limnPart *part) { + + if (part) { + airArrayNuke(part->vertIdxArr); + airArrayNuke(part->edgeIdxArr); + airArrayNuke(part->faceIdxArr); + } + return; + } + + void + _limnObjectFaceEmpty(limnFace *face) { + + if (face) { + airFree(face->vertIdxIdx); + airFree(face->edgeIdxIdx); + } + return; + } + limnObject * limnObjectNix(limnObject *obj) { + int partIdx, faceIdx; + for (partIdx=0; partIdx<obj->partNum; partIdx++) { + _limnObjectPartEmpty(obj->part + partIdx); + } + for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { + _limnObjectFaceEmpty(obj->face + faceIdx); + } airArrayNuke(obj->vertArr); airArrayNuke(obj->edgeArr); Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** renderLimn.c 9 Feb 2004 22:48:01 -0000 1.17 --- renderLimn.c 9 Feb 2004 23:47:32 -0000 1.18 *************** *** 106,110 **** part = obj->part + face->partIdx; for (vii=0; vii<face->sideNum; vii++) { ! vert = obj->vert + part->vertIdx[vii]; fprintf(win->file, "%g %g %s\n", vert->device[0], vert->device[1], vii ? "L" : "M"); --- 106,110 ---- part = obj->part + face->partIdx; for (vii=0; vii<face->sideNum; vii++) { ! vert = obj->vert + part->vertIdx[face->vertIdxIdx[vii]]; fprintf(win->file, "%g %g %s\n", vert->device[0], vert->device[1], vii ? "L" : "M"); *************** *** 148,152 **** fprintf(win->file, "%g %g M ", vert0->device[0], vert0->device[1]); fprintf(win->file, "%g %g L ", vert1->device[0], vert1->device[1]); ! fprintf(win->file, "%g W ", win->ps.lineWidth[edge->type]); fprintf(win->file, "S\n"); } --- 148,152 ---- fprintf(win->file, "%g %g M ", vert0->device[0], vert0->device[1]); fprintf(win->file, "%g %g L ", vert1->device[0], vert1->device[1]); ! fprintf(win->file, "%g W 0 Gr ", win->ps.lineWidth[edge->type]); fprintf(win->file, "S\n"); } *************** *** 183,187 **** limnObjectDepthSortParts(obj); ! _limnPSPreamble(obj, cam, win); --- 183,187 ---- limnObjectDepthSortParts(obj); ! _limnPSPreamble(obj, cam, win); *************** *** 222,228 **** */ } else { ! /* this part is either a lone face or a solid */ ! ! /* draw the front-facing, shaded faces */ for (fii=0; fii<part->faceIdxNum; fii++) { face = obj->face + part->faceIdx[fii]; --- 222,227 ---- */ } else { ! /* this part is either a lone face or a solid: ! draw the front-facing, shaded faces */ for (fii=0; fii<part->faceIdxNum; fii++) { face = obj->face + part->faceIdx[fii]; |
|
From: <kin...@us...> - 2004-02-09 07:24:25
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30901 Modified Files: qbert.c Log Message: qbert now defaults to three-channel VGH, instead of two-channel BG Index: qbert.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/qbert.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** qbert.c 7 Jan 2004 15:34:28 -0000 1.18 --- qbert.c 9 Feb 2004 07:21:14 -0000 1.19 *************** *** 528,532 **** char *me, *outS, *errS; Nrrd *nin, *npad, *nrsmp, *nvghF, *nvhist, *nghist, *nhhist, *nvgh; ! int E, i, sz[3], ups, doH, useFloat, scat; NrrdKernelSpec *k00, *k11, *k22; double amin[4], amax[4], spacing[4]; --- 528,532 ---- char *me, *outS, *errS; Nrrd *nin, *npad, *nrsmp, *nvghF, *nvhist, *nghist, *nhhist, *nvgh; ! int E, i, sz[3], ups, notdoH, useFloat, scat; NrrdKernelSpec *k00, *k11, *k22; double amin[4], amax[4], spacing[4]; *************** *** 549,555 **** "input volume, in nrrd format", NULL, NULL, nrrdHestNrrd); ! hestOptAdd(&hopt, "h", NULL, airTypeInt, 0, 0, &doH, NULL, ! "Make a 3-channel VGH volume, instead of the usual (default) " ! "2-channel VG volume."); hestOptAdd(&hopt, "f", NULL, airTypeInt, 0, 0, &useFloat, NULL, "Keep the output volume in floating point, instead of " --- 549,555 ---- "input volume, in nrrd format", NULL, NULL, nrrdHestNrrd); ! hestOptAdd(&hopt, "vg", NULL, airTypeInt, 0, 0, ¬doH, NULL, ! "Make a 2-channel VG volume, instead of the usual (default) " ! "3-channel VGH volume."); hestOptAdd(&hopt, "f", NULL, airTypeInt, 0, 0, &useFloat, NULL, "Keep the output volume in floating point, instead of " *************** *** 586,590 **** "0.000", "Percent of voxels to through away in quantization (if doing " ! "quantization) based their data value being too or too low. "); hestOptAdd(&hopt, "gp", "G perc", airTypeFloat, 1, 1, &gperc, "0.002", "Like \"-vp\", but for gradient magnitudes. "); --- 586,591 ---- "0.000", "Percent of voxels to through away in quantization (if doing " ! "quantization) based their data value being too high or " ! "too low. "); hestOptAdd(&hopt, "gp", "G perc", airTypeFloat, 1, 1, &gperc, "0.002", "Like \"-vp\", but for gradient magnitudes. "); *************** *** 655,659 **** nvghF = nrrdNew(); airMopAdd(mop, nvghF, (airMopper)nrrdNuke, airMopAlways); ! if (qbertProbe(nvghF, nrsmp, k00, k11, k22, doH, sz)) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); --- 656,660 ---- nvghF = nrrdNew(); airMopAdd(mop, nvghF, (airMopper)nrrdNuke, airMopAlways); ! if (qbertProbe(nvghF, nrsmp, k00, k11, k22, !notdoH, sz)) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); *************** *** 666,670 **** /* we're done! */ if (scat && (qbertScat(nvghF, 1, scat, "vg.pgm") ! || (doH && qbertScat(nvghF, 2, scat, "vh.pgm")))) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); --- 667,671 ---- /* we're done! */ if (scat && (qbertScat(nvghF, 1, scat, "vg.pgm") ! || (!notdoH && qbertScat(nvghF, 2, scat, "vh.pgm")))) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); *************** *** 698,702 **** if (scat && (qbertScat(nvgh, 1, scat, "vg.pgm") ! || (doH && qbertScat(nvgh, 2, scat, "vh.pgm")))) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); --- 699,703 ---- if (scat && (qbertScat(nvgh, 1, scat, "vg.pgm") ! || (!notdoH && qbertScat(nvgh, 2, scat, "vh.pgm")))) { airMopAdd(mop, errS=biffGetDone(QBERT), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, errS); *************** *** 705,709 **** /* do final decoration of axes */ ! nrrdAxisInfoSet(nvgh, nrrdAxisInfoLabel, "vgh", "x", "y", "z"); nrrdAxisInfoSet_nva(nvgh, nrrdAxisInfoMin, amin); nrrdAxisInfoSet_nva(nvgh, nrrdAxisInfoMax, amax); --- 706,712 ---- /* do final decoration of axes */ ! nrrdAxisInfoSet(nvgh, nrrdAxisInfoLabel, ! !notdoH ? "vgh" : "vg", ! "x", "y", "z"); nrrdAxisInfoSet_nva(nvgh, nrrdAxisInfoMin, amin); nrrdAxisInfoSet_nva(nvgh, nrrdAxisInfoMax, amax); |
|
From: <kin...@us...> - 2004-02-09 07:23:56
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30801 Modified Files: emap.c Log Message: reflect changes in limnQN Index: emap.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/emap.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** emap.c 7 Jan 2004 15:34:28 -0000 1.6 --- emap.c 9 Feb 2004 07:20:46 -0000 1.7 *************** *** 28,37 **** "camera parameters, this allows for both lights in " "both world and view space. Solely out of laziness, " ! "the nrrd format is used for specifying the lights. " ! "For N lights, the nrrd must be a 7 x N array of floats; " ! "the 7 values are: 0/1 (world/view space), R\tG\tB color, " ! "X\tY\tZ position. The most convenient way of doing this " ! "is to put this information in a text file, one line " ! "per light."); int --- 28,36 ---- "camera parameters, this allows for both lights in " "both world and view space. Solely out of laziness, " ! "the nrrd format is used for specifying the lights, but not " ! "to worry: you can use a simple un-adorned text file, " ! "defining one light per line, with 7 values per light: " ! "0/1 (world/view space), R\tG\tB color, and " ! "X\tY\tZ position."); int *************** *** 112,116 **** nmap=nrrdNew(); airMopAdd(mop, nmap, (airMopper)nrrdNuke, airMopAlways); ! if (limnEnvMapFill(nmap, limnLightDiffuseCB, limnQN_16checker, light)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem making environment map:\n%s\n", me, errS); --- 111,115 ---- nmap=nrrdNew(); airMopAdd(mop, nmap, (airMopper)nrrdNuke, airMopAlways); ! if (limnEnvMapFill(nmap, limnLightDiffuseCB, limnQN16checker, light)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem making environment map:\n%s\n", me, errS); *************** *** 142,146 **** ELL_3V_SET(V, u, v, -w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN[limnQN_16checker](W); ELL_3V_COPY(debug + 3*(ui + 1024*vi), map + 3*qn); --- 141,145 ---- ELL_3V_SET(V, u, v, -w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[limnQN16checker](W); ELL_3V_COPY(debug + 3*(ui + 1024*vi), map + 3*qn); *************** *** 148,152 **** ELL_3V_SET(V, u, v, w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN[limnQN_16checker](W); ELL_3V_COPY(debug + 3*(ui + 512 + 1024*vi), map + 3*qn); } --- 147,151 ---- ELL_3V_SET(V, u, v, w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[limnQN16checker](W); ELL_3V_COPY(debug + 3*(ui + 512 + 1024*vi), map + 3*qn); } |
|
From: <kin...@us...> - 2004-02-09 07:21:31
|
Update of /cvsroot/teem/teem/src/echo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30542 Modified Files: echo.h lightEcho.c Log Message: reflect changes in limnQN Index: echo.h =================================================================== RCS file: /cvsroot/teem/teem/src/echo/echo.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** echo.h 7 Jan 2004 15:34:28 -0000 1.59 --- echo.h 9 Feb 2004 07:18:21 -0000 1.60 *************** *** 43,48 **** /* all position and transform information is kept as ... ! ** 1: floats ! ** 0: doubles */ #if 0 --- 43,48 ---- /* all position and transform information is kept as ... ! ** 1: float ! ** 0: double */ #if 0 *************** *** 56,61 **** /* all color information is kept as ! ** 1: floats ! ** 0: doubles */ #if 1 --- 56,61 ---- /* all color information is kept as ! ** 1: float ! ** 0: double */ #if 1 Index: lightEcho.c =================================================================== RCS file: /cvsroot/teem/teem/src/echo/lightEcho.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lightEcho.c 7 Jan 2004 15:34:28 -0000 1.10 --- lightEcho.c 9 Feb 2004 07:18:21 -0000 1.11 *************** *** 85,94 **** float *data; ! #if !ECHO_POS_FLOAT ! float norm_f[3]; ! ELL_3V_COPY(norm_f, norm); ! qn = limnVtoQN[limnQN_16checker](norm_f); #else ! qn = limnVtoQN[limnQN_16checker](norm); #endif data = (float*)(envmap->data) + 3*qn; --- 85,92 ---- float *data; ! #if ECHO_POS_FLOAT ! qn = limnVtoQN_f[limnQN16checker](norm); #else ! qn = limnVtoQN_d[limnQN16checker](norm); #endif data = (float*)(envmap->data) + 3*qn; |
|
From: <kin...@us...> - 2004-02-09 07:09:31
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28564 Modified Files: env.c io.c limn.h methodsLimn.c obj.c qn.c renderLimn.c transform.c Log Message: changed spelling of QN stuff: limnQN_xxx --> limnQNxxx added a few more checker-based normal quantization methods added simple and incomplete readers and writers for OFF file format added long-overdue enum for edge types (front vs. back, crease vs. non-crease, etc...) starting to add functionality to correctly draw non-convex objects and parts Index: env.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/env.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** env.c 7 Jan 2004 15:34:30 -0000 1.4 --- env.c 9 Feb 2004 07:06:18 -0000 1.5 *************** *** 31,40 **** biffAdd(LIMN, err); return 1; } ! if (!AIR_IN_OP(limnQN_Unknown, qnMethod, limnQN_Last)) { sprintf(err, "%s: QN method %d invalid", me, qnMethod); biffAdd(LIMN, err); return 1; } switch(qnMethod) { ! case limnQN_16checker: sx = sy = 256; if (nrrdMaybeAlloc(map, nrrdTypeFloat, 3, 3, sx, sy)) { --- 31,40 ---- biffAdd(LIMN, err); return 1; } ! if (!AIR_IN_OP(limnQNUnknown, qnMethod, limnQNLast)) { sprintf(err, "%s: QN method %d invalid", me, qnMethod); biffAdd(LIMN, err); return 1; } switch(qnMethod) { ! case limnQN16checker: sx = sy = 256; if (nrrdMaybeAlloc(map, nrrdTypeFloat, 3, 3, sx, sy)) { *************** *** 44,48 **** mapData = map->data; for (qn=0; qn<=sx*sy-1; qn++) { ! limnQNtoV[limnQN_16checker](vec, qn); cb(mapData + 3*qn, vec, data); } --- 44,48 ---- mapData = map->data; for (qn=0; qn<=sx*sy-1; qn++) { ! limnQNtoV_f[limnQN16checker](vec, qn); cb(mapData + 3*qn, vec, data); } Index: io.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/io.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** io.c 7 Jan 2004 15:34:30 -0000 1.7 --- io.c 9 Feb 2004 07:06:18 -0000 1.8 *************** *** 62,63 **** --- 62,186 ---- return 0; } + + int + limnObjOFFWrite(FILE *file, limnObj *obj) { + char me[]="limnObjOFFWrite", err[AIR_STRLEN_MED]; + int ii, vi; + limnPoint *p; + limnFace *f; + + if (!( obj && file )) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(LIMN, err); return 1; + } + fprintf(file, "OFF\n"); + fprintf(file, "%d %d -1\n", obj->pA->len, obj->fA->len); + for (ii=0; ii<obj->pA->len; ii++) { + p = obj->p + ii; + fprintf(file, "%g %g %g", + p->w[0]/p->w[3], p->w[1]/p->w[3], p->w[2]/p->w[3]); + if (p->sp) { + /* its a non-default color */ + fprintf(file, " %g %g %g", obj->s[p->sp].rgba[0], + obj->s[p->sp].rgba[1], obj->s[p->sp].rgba[2]); + } + fprintf(file, "\n"); + } + for (ii=0; ii<obj->fA->len; ii++) { + f = obj->f + ii; + fprintf(file, "%d", f->vNum); + for (vi=0; vi<f->vNum; vi++) { + fprintf(file, " %d", obj->v[vi + f->vBase]); + } + if (f->sp) { + fprintf(file, " %g %g %g", obj->s[f->sp].rgba[0], + obj->s[f->sp].rgba[1], obj->s[f->sp].rgba[2]); + } + fprintf(file, "\n"); + } + return 0; + } + + int + limnObjOFFRead(limnObj *obj, FILE *file) { + char me[]="limnObjOFFRead", err[AIR_STRLEN_MED]; + double vert[6]; + char line[AIR_STRLEN_LARGE]; /* HEY: bad bad Gordon */ + int si, lret, nvert, nface, ii, got, ibuff[512]; /* HEY: bad bad Gordon */ + float fbuff[512]; /* HEY: bad bad Gordon */ + + if (!( obj && file )) { + sprintf(err, "%s: got NULL pointer", me); + biffAdd(LIMN, err); return 1; + } + got = 0; + do { + if (!airOneLine(file, line, AIR_STRLEN_LARGE)) { + sprintf(err, "%s: hit EOF before getting #vert #face #edge line", me); + biffAdd(LIMN, err); return 1; + } + got = airParseStrI(ibuff, line, AIR_WHITESPACE, 3); + } while (3 != got); + nvert = ibuff[0]; + nface = ibuff[1]; + limnObjPartStart(obj); + for (ii=0; ii<nvert; ii++) { + do { + lret = airOneLine(file, line, AIR_STRLEN_LARGE); + } while (1 == lret); + if (!lret) { + sprintf(err, "%s: hit EOF trying to read vert %d (of %d)", + me, ii, nvert); + biffAdd(LIMN, err); return 1; + } + if (3 != airParseStrD(vert, line, AIR_WHITESPACE, 3)) { + sprintf(err, "%s: couldn't parse 3 doubles from \"%s\" " + "for vert %d (of %d)", + me, line, ii, nvert); + biffAdd(LIMN, err); return 1; + } + if (6 == airParseStrD(vert, line, AIR_WHITESPACE, 6)) { + /* we could also parse an RGB color */ + si = limnObjSPAdd(obj); + ELL_4V_SET(obj->s[si].rgba, vert[3], vert[4], vert[5], 1); + } else { + si = 0; + } + limnObjPointAdd(obj, si, vert[0], vert[1], vert[2]); + } + for (ii=0; ii<nface; ii++) { + do { + lret = airOneLine(file, line, AIR_STRLEN_LARGE); + } while (1 == lret); + if (!lret) { + sprintf(err, "%s: hit EOF trying to read face %d (of %d)", + me, ii, nface); + biffAdd(LIMN, err); return 1; + } + if (1 != sscanf(line, "%d", &nvert)) { + sprintf(err, "%s: can't get first int (#verts) from \"%s\" " + "for face %d (of %d)", + me, line, ii, nface); + biffAdd(LIMN, err); return 1; + } + if (nvert+1 != airParseStrI(ibuff, line, AIR_WHITESPACE, nvert+1)) { + sprintf(err, "%s: couldn't parse %d ints from \"%s\" " + "for face %d (of %d)", + me, nvert+1, line, ii, nface); + biffAdd(LIMN, err); return 1; + } + if (nvert+1+3 == airParseStrF(fbuff, line, AIR_WHITESPACE, nvert+1+3)) { + /* could also parse color */ + si = limnObjSPAdd(obj); + ELL_4V_SET(obj->s[si].rgba, + fbuff[nvert+1+0], fbuff[nvert+1+1], fbuff[nvert+1+2], 1); + } else { + si = 0; + } + limnObjFaceAdd(obj, si, nvert, ibuff+1); + } + limnObjPartFinish(obj); + + return 0; + } + Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** limn.h 7 Jan 2004 15:34:30 -0000 1.44 --- limn.h 9 Feb 2004 07:06:18 -0000 1.45 *************** *** 125,137 **** }; typedef struct { ! float edgeWidth[5], /* different line thickness for different edge types: ! 0 : non-crease edge, backfacing ! 1 : crease edge, backfacing ! 2 : silhouette edge (crease or non-crease) ! 3 : crease edge: front-facing ! 4 : non-crease edge, front-facing */ ! creaseAngle, ! bg[3]; /* background color */ } limnOptsPS; --- 125,148 ---- }; + enum { + limnEdgeTypeUnknown, /* 0 */ + limnEdgeTypeBackFacet, /* 1: back-facing non-crease */ + limnEdgeTypeBackCrease, /* 2: back-facing crease */ + limnEdgeTypeContour, /* 3: silhoette edge */ + limnEdgeTypeFrontCrease, /* 4: front-facing crease */ + limnEdgeTypeFrontFacet, /* 5: front-facing non-crease */ + limnEdgeTypeBorder, /* 6: attached to only one face */ + limnEdgeTypeLone, /* 7: attached to no other faces */ + limnEdgeTypeLast + }; + #define LIMN_EDGE_TYPE_MAX 5 + typedef struct { ! float lineWidth[LIMN_EDGE_TYPE_MAX+1], ! haloWidth[LIMN_EDGE_TYPE_MAX+1], ! creaseAngle, /* difference between crease and facet, in *degrees* */ ! bg[3]; /* background color */ ! int showpage, /* finish with "showpage" */ ! wireFrame; /* just render wire-frame */ } limnOptsPS; *************** *** 181,185 **** sp; /* index into parent's SP list */ ! int visib; /* is edge currently visible (or active) */ } limnEdge; --- 192,196 ---- sp; /* index into parent's SP list */ ! int type; /* from the limnEdgeType enum */ } limnEdge; *************** *** 197,201 **** sp; /* index into parent's SP list, "s" */ ! int visib; /* is face currently visible */ float z; /* for depth ordering */ } limnFace; --- 208,212 ---- sp; /* index into parent's SP list, "s" */ ! int visib; /* is face currently visible (AIR_TRUE or AIR_FALSE) */ float z; /* for depth ordering */ } limnFace; *************** *** 211,220 **** pBase, pNum, /* start and length in parent's limnPoint array, "p" */ origIdx; /* initial part index of this part */ ! float z; /* assuming that the occlusion graph between whole parts is acyclic, one depth value is good enough for painter's algorithm ordering of drawing */ ! float rgba[4]; } limnPart; --- 222,231 ---- pBase, pNum, /* start and length in parent's limnPoint array, "p" */ origIdx; /* initial part index of this part */ ! float z; /* assuming that the occlusion graph between whole parts is acyclic, one depth value is good enough for painter's algorithm ordering of drawing */ ! int sp; /* index into parent's SP list, "s" */ } limnPart; *************** *** 249,252 **** --- 260,264 ---- limnFace *f; /* array of face structs */ airArray *fA; /* airArray around "f" */ + int *fSort; /* indices into "f", sorted by depth */ limnPart *r; /* array of part structs */ *************** *** 267,278 **** */ enum { ! limnQN_Unknown, /* 0 */ ! limnQN_16checker, /* 1 */ ! limnQN_16simple, /* 2 */ ! limnQN_16border1, /* 3 */ ! limnQN_15checker, /* 4 */ ! limnQN_Last }; ! #define LIMN_QN_MAX 4 enum { --- 279,292 ---- */ enum { ! limnQNUnknown, /* 0 */ ! limnQN16checker, /* 1 */ ! limnQN16simple, /* 2 */ ! limnQN16border1, /* 3 */ ! limnQN15checker, /* 4 */ ! limnQN14checker, /* 5 */ ! limnQN12checker, /* 6 */ ! limnQNLast }; ! #define LIMN_QN_MAX 6 enum { *************** *** 347,353 **** /* qn.c */ ! extern limn_export int limnQNBytes[LIMN_QN_MAX+1]; ! extern limn_export void (*limnQNtoV[LIMN_QN_MAX+1])(float *vec, int qn); ! extern limn_export int (*limnVtoQN[LIMN_QN_MAX+1])(float *vec); /* light.c */ --- 361,370 ---- /* qn.c */ ! extern limn_export int limnQNBins[LIMN_QN_MAX+1]; ! extern limn_export void (*limnQNtoV_f[LIMN_QN_MAX+1])(float *vec, int qn); ! extern limn_export void (*limnQNtoV_d[LIMN_QN_MAX+1])(double *vec, int qn); ! extern limn_export int (*limnVtoQN_f[LIMN_QN_MAX+1])(float *vec); ! extern limn_export int (*limnVtoQN_d[LIMN_QN_MAX+1])(double *vec); ! /* light.c */ *************** *** 404,407 **** --- 421,426 ---- /* io.c */ extern int limnObjDescribe(FILE *file, limnObj *obj); + extern int limnObjOFFRead(limnObj *obj, FILE *file); + extern int limnObjOFFWrite(FILE *file, limnObj *obj); /* shapes.c */ *************** *** 424,430 **** --- 443,452 ---- extern int limnObjPartTransform(limnObj *obj, int ri, float tx[16]); extern int limnObjDepthSortParts(limnObj *obj); + extern int limnObjDepthSortFaces(limnObj *obj); /* renderLimn.c */ extern int limnObjRender(limnObj *obj, limnCamera *cam, limnWin *win); + extern int limnObjPSDrawOld(limnObj *obj, limnCamera *cam, + Nrrd *envMap, limnWin *win); extern int limnObjPSDraw(limnObj *obj, limnCamera *cam, Nrrd *envMap, limnWin *win); Index: methodsLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/methodsLimn.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** methodsLimn.c 7 Jan 2004 15:34:30 -0000 1.9 --- methodsLimn.c 9 Feb 2004 07:06:18 -0000 1.10 *************** *** 71,80 **** _limnOptsPSDefaults(limnOptsPS *ps) { ! ps->edgeWidth[0] = 0.0; ! ps->edgeWidth[1] = 0.0; ! ps->edgeWidth[2] = 2.0; ! ps->edgeWidth[3] = 1.0; ! ps->edgeWidth[4] = 0.0; ps->creaseAngle = 46; ELL_3V_SET(ps->bg, 1, 1, 1); } --- 71,93 ---- _limnOptsPSDefaults(limnOptsPS *ps) { ! ps->lineWidth[limnEdgeTypeUnknown] = AIR_NAN; ! ps->lineWidth[limnEdgeTypeBackFacet] = 0.0; ! ps->lineWidth[limnEdgeTypeBackCrease] = 0.0; ! ps->lineWidth[limnEdgeTypeContour] = 2.0; ! ps->lineWidth[limnEdgeTypeFrontCrease] = 1.0; ! ps->lineWidth[limnEdgeTypeFrontFacet] = 0.0; ! ps->lineWidth[limnEdgeTypeBorder] = 1.0; ! ps->lineWidth[limnEdgeTypeLone] = 1.0; ! ps->haloWidth[limnEdgeTypeUnknown] = AIR_NAN; ! ps->haloWidth[limnEdgeTypeBackFacet] = 0.0; ! ps->haloWidth[limnEdgeTypeBackCrease] = 0.0; ! ps->haloWidth[limnEdgeTypeContour] = 0.0; ! ps->haloWidth[limnEdgeTypeFrontCrease] = 0.0; ! ps->haloWidth[limnEdgeTypeFrontFacet] = 0.0; ! ps->haloWidth[limnEdgeTypeBorder] = 0.0; ! ps->haloWidth[limnEdgeTypeLone] = 0.0; ps->creaseAngle = 46; + ps->showpage = AIR_FALSE; + ps->wireFrame = AIR_FALSE; ELL_3V_SET(ps->bg, 1, 1, 1); } Index: obj.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/obj.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** obj.c 7 Jan 2004 15:34:30 -0000 1.14 --- obj.c 9 Feb 2004 07:06:18 -0000 1.15 *************** *** 30,33 **** --- 30,34 ---- obj->e = NULL; obj->f = NULL; + obj->fSort = NULL; obj->r = NULL; obj->s = NULL; *************** *** 60,63 **** --- 61,65 ---- airArrayNuke(obj->eA); airArrayNuke(obj->fA); + airFree(obj->fSort); airArrayNuke(obj->rA); airArrayNuke(obj->sA); *************** *** 77,81 **** r->pBase = obj->pA->len; r->pNum = 0; r->origIdx = rBase; ! ELL_4V_SET(r->rgba, 1.0, 1.0, 1.0, 1.0); obj->rCurr = r; --- 79,83 ---- r->pBase = obj->pA->len; r->pNum = 0; r->origIdx = rBase; ! r->sp = 0; obj->rCurr = r; *************** *** 109,113 **** e->f1 = -1; e->sp = sp; ! e->visib = 0; } --- 111,115 ---- e->f1 = -1; e->sp = sp; ! e->type = limnEdgeTypeUnknown; } *************** *** 184,189 **** int limnObjSPAdd(limnObj *obj) { ! return airArrayIncrLen(obj->sA, 1); } - --- 186,197 ---- int limnObjSPAdd(limnObj *obj) { + int sBase; + limnSP *s; ! sBase = airArrayIncrLen(obj->sA, 1); ! s = &(obj->s[sBase]); ! ELL_4V_SET(s->rgba, 1, 1, 1, 1); ! ELL_3V_SET(s->k, 0.5, 0.5, 0.0); ! s->spec = 50; ! return sBase; } Index: qn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/qn.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** qn.c 7 Jan 2004 15:34:30 -0000 1.16 --- qn.c 9 Feb 2004 07:06:18 -0000 1.17 *************** *** 31,46 **** */ - int - limnQNBytes[LIMN_QN_MAX+1] = { - 0, /* limnQN_Unknown */ - 2, /* limnQN_16checker */ - 2, /* limnQN_16simple */ - 2, /* limnQN_16border1 */ - 2 /* limnQN_15checker */ - }; - - void ! _limnQN_16simple_QNtoV(float *vec, int qn) { int xi, yi; float x, y, z, n; --- 31,36 ---- */ void ! _limnQN16simple_QNtoV_f(float *vec, int qn) { int xi, yi; float x, y, z, n; *************** *** 65,69 **** int ! _limnQN_16simple_VtoQN(float *vec) { float x, y, z, L, w; int sgn = 0; --- 55,59 ---- int ! _limnQN16simple_VtoQN_f(float *vec) { float x, y, z, L, w; int sgn = 0; *************** *** 116,165 **** the error due to quantization is unbiased */ void ! _limnQN_16checker_QNtoV(float *vec, int qn) { int ui, vi; ! float u, v, x, y, z, n; ! ui = qn & 0xFF; ! vi = (qn >> 8) & 0xFF; ! u = AIR_AFFINE(0, ui, 255, -0.5, 0.5); ! v = AIR_AFFINE(0, vi, 255, -0.5, 0.5); ! x = u + v; ! y = u - v; ! z = 1 - AIR_ABS(x) - AIR_ABS(y); ! /* would this be better served by a branch? */ ! z *= (((ui ^ vi) & 0x01) << 1) - 1; ! n = 1.0/sqrt(x*x + y*y + z*z); ! vec[0] = x*n; ! vec[1] = y*n; ! vec[2] = z*n; } int ! _limnQN_16checker_VtoQN(float *vec) { ! float L, x, y, z; int xi, yi, ui, vi; ! ! x = vec[0]; ! y = vec[1]; ! z = vec[2]; ! L = AIR_ABS(x) + AIR_ABS(y) + AIR_ABS(z); ! if (!L) { ! return 0; ! } ! x /= L; ! y /= L; ! if (z > 0) { ! AIR_INDEX(-1.0, x, 1.0, 255, xi); ! AIR_INDEX(-1.0 - 1.0/255, y, 1.0 + 1.0/255, 256, yi); ! ui = xi + yi - 127; ! vi = xi - yi + 128; ! } ! else { ! AIR_INDEX(-1.0 - 1.0/255, x, 1.0 + 1.0/255, 256, xi); ! AIR_INDEX(-1, y, 1, 255, yi); ! ui = xi + yi - 127; ! vi = xi - yi + 127; ! } return (vi << 8) | ui; } --- 106,178 ---- the error due to quantization is unbiased */ + #define _16_QtoV(vec, qn) \ + ui = (qn) & 0xFF; \ + vi = ((qn) >> 8) & 0xFF; \ + u = AIR_AFFINE(0, ui, 255, -0.5, 0.5); \ + v = AIR_AFFINE(0, vi, 255, -0.5, 0.5); \ + x = u + v; \ + y = u - v; \ + z = 1 - AIR_ABS(x) - AIR_ABS(y); \ + /* would this be better served by a branch? */ \ + z *= (((ui ^ vi) & 0x01) << 1) - 1; \ + n = 1.0/sqrt(x*x + y*y + z*z); \ + (vec)[0] = x*n; \ + (vec)[1] = y*n; \ + (vec)[2] = z*n + void ! _limnQN16checker_QNtoV_f(float *vec, int qn) { int ui, vi; ! double u, v, x, y, z, n; ! _16_QtoV(vec, qn); } + void + _limnQN16checker_QNtoV_d(double *vec, int qn) { + int ui, vi; + double u, v, x, y, z, n; + + _16_QtoV(vec, qn); + } + + #define _16_VtoQ(vec) \ + x = (vec)[0]; \ + y = (vec)[1]; \ + z = (vec)[2]; \ + L = AIR_ABS(x) + AIR_ABS(y) + AIR_ABS(z); \ + if (!L) { \ + return 0; \ + } \ + x /= L; \ + y /= L; \ + if (z > 0) { \ + AIR_INDEX(-1.0, x, 1.0, 255, xi); \ + AIR_INDEX(-1.0 - 1.0/255, y, 1.0 + 1.0/255, 256, yi); \ + ui = xi + yi - 127; \ + vi = xi - yi + 128; \ + } \ + else { \ + AIR_INDEX(-1.0 - 1.0/255, x, 1.0 + 1.0/255, 256, xi); \ + AIR_INDEX(-1, y, 1, 255, yi); \ + ui = xi + yi - 127; \ + vi = xi - yi + 127; \ + } + int ! _limnQN16checker_VtoQN_f(float *vec) { ! double L, x, y, z; int xi, yi, ui, vi; ! ! _16_VtoQ(vec); ! return (vi << 8) | ui; ! } ! ! int ! _limnQN16checker_VtoQN_d(double *vec) { ! double L, x, y, z; ! int xi, yi, ui, vi; ! ! _16_VtoQ(vec); return (vi << 8) | ui; } *************** *** 168,172 **** void ! _limnQN_16border1_QNtoV(float *vec, int qn) { int ui, vi; float u, v, x, y, z, n; --- 181,185 ---- void ! _limnQN16border1_QNtoV_f(float *vec, int qn) { int ui, vi; float u, v, x, y, z, n; *************** *** 187,191 **** int ! _limnQN_16border1_VtoQN(float *vec) { float L, u, v, x, y, z; int ui, vi, zi; --- 200,204 ---- int ! _limnQN16border1_VtoQN_f(float *vec) { float L, u, v, x, y, z; int ui, vi, zi; *************** *** 225,229 **** void ! _limnQN_15checker_QNtoV(float *vec, int qn) { int ui, vi, zi; float u, v, x, y, z, n; --- 238,242 ---- void ! _limnQN15checker_QNtoV_f(float *vec, int qn) { int ui, vi, zi; float u, v, x, y, z, n; *************** *** 245,249 **** int ! _limnQN_15checker_VtoQN(float *vec) { float L, u, v, x, y, z; int ui, vi, zi; --- 258,262 ---- int ! _limnQN15checker_VtoQN_f(float *vec) { float L, u, v, x, y, z; int ui, vi, zi; *************** *** 266,283 **** } ! void (*limnQNtoV[LIMN_QN_MAX+1])(float *, int) = { NULL, ! _limnQN_16checker_QNtoV, ! _limnQN_16simple_QNtoV, ! _limnQN_16border1_QNtoV, ! _limnQN_15checker_QNtoV }; ! int (*limnVtoQN[LIMN_QN_MAX+1])(float *vec) = { NULL, ! _limnQN_16checker_VtoQN, ! _limnQN_16simple_VtoQN, ! _limnQN_16border1_VtoQN, ! _limnQN_15checker_VtoQN }; --- 279,484 ---- } ! /* ----------------------------------------------------------- */ ! ! #define _14_QNtoV(vec, qn) \ ! ui = (qn) & 0x7F; \ ! vi = ((qn) >> 7) & 0x7F; \ ! u = AIR_AFFINE(0, ui, 127, -0.5, 0.5); \ ! v = AIR_AFFINE(0, vi, 127, -0.5, 0.5); \ ! x = u + v; \ ! y = u - v; \ ! z = 1 - AIR_ABS(x) - AIR_ABS(y); \ ! /* would this be better served by a branch? */ \ ! z *= (((ui ^ vi) & 0x01) << 1) - 1; \ ! n = 1.0/sqrt(x*x + y*y + z*z); \ ! (vec)[0] = x*n; \ ! (vec)[1] = y*n; \ ! (vec)[2] = z*n ! ! void ! _limnQN14checker_QNtoV_f(float *vec, int qn) { ! int ui, vi; ! double u, v, x, y, z, n; ! ! _14_QNtoV(vec, qn); ! } ! ! void ! _limnQN14checker_QNtoV_d(double *vec, int qn) { ! int ui, vi; ! double u, v, x, y, z, n; ! ! _14_QNtoV(vec, qn); ! } ! ! #define _14_VtoQN(vec) \ ! x = (vec)[0]; \ ! y = (vec)[1]; \ ! z = (vec)[2]; \ ! L = AIR_ABS(x) + AIR_ABS(y) + AIR_ABS(z); \ ! if (!L) { \ ! return 0; \ ! } \ ! x /= L; \ ! y /= L; \ ! if (z > 0) { \ ! AIR_INDEX(-1.0, x, 1.0, 127, xi); \ ! AIR_INDEX(-1.0 - 1.0/127, y, 1.0 + 1.0/127, 128, yi); \ ! ui = xi + yi - 63; \ ! vi = xi - yi + 64; \ ! } \ ! else { \ ! AIR_INDEX(-1.0 - 1.0/127, x, 1.0 + 1.0/127, 128, xi); \ ! AIR_INDEX(-1, y, 1, 127, yi); \ ! ui = xi + yi - 63; \ ! vi = xi - yi + 63; \ ! } ! ! int ! _limnQN14checker_VtoQN_f(float *vec) { ! double L, x, y, z; ! int xi, yi, ui, vi; ! ! _14_VtoQN(vec); ! return (vi << 7) | ui; ! } ! ! int ! _limnQN14checker_VtoQN_d(double *vec) { ! double L, x, y, z; ! int xi, yi, ui, vi; ! ! _14_VtoQN(vec); ! return (vi << 7) | ui; ! } ! ! /* ----------------------------------------------------------- */ ! ! #define _12_QNtoV(vec, qn) \ ! ui = (qn) & 0x3F; \ ! vi = ((qn) >> 6) & 0x3F; \ ! u = AIR_AFFINE(0, ui, 63, -0.5, 0.5); \ ! v = AIR_AFFINE(0, vi, 63, -0.5, 0.5); \ ! x = u + v; \ ! y = u - v; \ ! z = 1 - AIR_ABS(x) - AIR_ABS(y); \ ! /* would this be better served by a branch? */ \ ! z *= (((ui ^ vi) & 0x01) << 1) - 1; \ ! n = 1.0/sqrt(x*x + y*y + z*z); \ ! (vec)[0] = x*n; \ ! (vec)[1] = y*n; \ ! (vec)[2] = z*n ! ! void ! _limnQN12checker_QNtoV_f(float *vec, int qn) { ! int ui, vi; ! double u, v, x, y, z, n; ! ! _12_QNtoV(vec, qn); ! } ! ! void ! _limnQN12checker_QNtoV_d(double *vec, int qn) { ! int ui, vi; ! double u, v, x, y, z, n; ! ! _12_QNtoV(vec, qn); ! } ! ! #define _12_VtoQN(vec) \ ! x = vec[0]; \ ! y = vec[1]; \ ! z = vec[2]; \ ! L = AIR_ABS(x) + AIR_ABS(y) + AIR_ABS(z); \ ! if (!L) { \ ! return 0; \ ! } \ ! x /= L; \ ! y /= L; \ ! if (z > 0) { \ ! AIR_INDEX(-1.0, x, 1.0, 63, xi); \ ! AIR_INDEX(-1.0 - 1.0/63, y, 1.0 + 1.0/63, 64, yi); \ ! ui = xi + yi - 31; \ ! vi = xi - yi + 32; \ ! } \ ! else { \ ! AIR_INDEX(-1.0 - 1.0/63, x, 1.0 + 1.0/63, 64, xi); \ ! AIR_INDEX(-1, y, 1, 63, yi); \ ! ui = xi + yi - 31; \ ! vi = xi - yi + 31; \ ! } ! ! int ! _limnQN12checker_VtoQN_f(float *vec) { ! double L, x, y, z; ! int xi, yi, ui, vi; ! ! _12_VtoQN(vec); ! return (vi << 6) | ui; ! } ! ! int ! _limnQN12checker_VtoQN_d(double *vec) { ! double L, x, y, z; ! int xi, yi, ui, vi; ! ! _12_VtoQN(vec); ! return (vi << 6) | ui; ! } ! ! /* ----------------------------------------------------------- */ ! ! void (* ! limnQNtoV_f[LIMN_QN_MAX+1])(float *, int) = { NULL, ! _limnQN16checker_QNtoV_f, ! _limnQN16simple_QNtoV_f, ! _limnQN16border1_QNtoV_f, ! _limnQN15checker_QNtoV_f, ! _limnQN14checker_QNtoV_f, ! _limnQN12checker_QNtoV_f }; ! void (* ! limnQNtoV_d[LIMN_QN_MAX+1])(double *, int) = { NULL, ! _limnQN16checker_QNtoV_d, ! NULL, ! NULL, ! NULL, ! _limnQN14checker_QNtoV_d, ! _limnQN12checker_QNtoV_d ! }; ! ! int (* ! limnVtoQN_f[LIMN_QN_MAX+1])(float *vec) = { ! NULL, ! _limnQN16checker_VtoQN_f, ! _limnQN16simple_VtoQN_f, ! _limnQN16border1_VtoQN_f, ! _limnQN15checker_VtoQN_f, ! _limnQN14checker_VtoQN_f, ! _limnQN12checker_VtoQN_f ! }; ! ! int (* ! limnVtoQN_d[LIMN_QN_MAX+1])(double *vec) = { ! NULL, ! _limnQN16checker_VtoQN_d, ! NULL, ! NULL, ! NULL, ! _limnQN14checker_VtoQN_d, ! _limnQN12checker_VtoQN_d ! }; ! ! int ! limnQNBins[LIMN_QN_MAX+1] = { ! -1, ! (1 << 16), ! (1 << 16), ! (1 << 15), ! (1 << 14), ! (1 << 12) }; Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** renderLimn.c 7 Jan 2004 15:34:30 -0000 1.15 --- renderLimn.c 9 Feb 2004 07:06:18 -0000 1.16 *************** *** 87,91 **** fprintf(win->file, "grestore\n"); fprintf(win->file, "grestore\n"); ! /* fprintf(win->file, "showpage\n"); */ fprintf(win->file, "%%%%Trailer\n"); } --- 87,93 ---- fprintf(win->file, "grestore\n"); fprintf(win->file, "grestore\n"); ! if (win->ps.showpage) { ! fprintf(win->file, "showpage\n"); ! } fprintf(win->file, "%%%%Trailer\n"); } *************** *** 109,124 **** fprintf(stderr, "RGB = %g %g %g ->", r->rgba[0], r->rgba[1], r->rgba[2]); */ ! R = sp->k[0]*r->rgba[0]; ! G = sp->k[0]*r->rgba[1]; ! B = sp->k[0]*r->rgba[2]; /* fprintf(stderr, "RGB = %g %g %g ->", R, G, B); */ if (nmap) { ! qn = limnVtoQN[limnQN_16checker](f->wn); map = nmap->data; ! R += sp->k[1]*r->rgba[0]*map[0 + 3*qn]; ! G += sp->k[1]*r->rgba[1]*map[1 + 3*qn]; ! B += sp->k[1]*r->rgba[2]*map[2 + 3*qn]; } /* HEY: not evaluating phong specular for now */ --- 111,130 ---- fprintf(stderr, "RGB = %g %g %g ->", r->rgba[0], r->rgba[1], r->rgba[2]); */ ! R = sp->k[0]*sp->rgba[0]; ! G = sp->k[0]*sp->rgba[1]; ! B = sp->k[0]*sp->rgba[2]; /* fprintf(stderr, "RGB = %g %g %g ->", R, G, B); */ if (nmap) { ! qn = limnVtoQN_f[limnQN16checker](f->wn); map = nmap->data; ! R += sp->k[1]*sp->rgba[0]*map[0 + 3*qn]; ! G += sp->k[1]*sp->rgba[1]*map[1 + 3*qn]; ! B += sp->k[1]*sp->rgba[2]*map[2 + 3*qn]; ! } else { ! R += sp->k[1]*sp->rgba[0]; ! G += sp->k[1]*sp->rgba[1]; ! B += sp->k[1]*sp->rgba[2]; } /* HEY: not evaluating phong specular for now */ *************** *** 145,154 **** limnPoint *p0, *p1; ! if (win->ps.edgeWidth[e->visib]) { p0 = obj->p + e->v0; p1 = obj->p + e->v1; fprintf(win->file, "%g %g M ", p0->d[0], p0->d[1]); fprintf(win->file, "%g %g L ", p1->d[0], p1->d[1]); ! fprintf(win->file, "%g W ", win->ps.edgeWidth[e->visib]); fprintf(win->file, "S\n"); } --- 151,160 ---- limnPoint *p0, *p1; ! if (win->ps.lineWidth[e->type]) { p0 = obj->p + e->v0; p1 = obj->p + e->v1; fprintf(win->file, "%g %g M ", p0->d[0], p0->d[1]); fprintf(win->file, "%g %g L ", p1->d[0], p1->d[1]); ! fprintf(win->file, "%g W ", win->ps.lineWidth[e->type]); fprintf(win->file, "S\n"); } *************** *** 156,160 **** /* ! ******** limnObjPSDraw ** ** draws a "rendered" limn object to postscript. --- 162,166 ---- /* ! ******** limnObjPSDrawOld ** ** draws a "rendered" limn object to postscript. *************** *** 167,174 **** */ int ! limnObjPSDraw(limnObj *obj, limnCamera *cam, Nrrd *nmap, limnWin *win) { char me[]="limnObjPSDraw", err[AIR_STRLEN_MED]; ! int vis0, vis1, inside; ! float angle, widthTmp; limnFace *f, *f0, *f1; int fi; limnEdge *e; int ei; --- 173,180 ---- */ int ! limnObjPSDrawOld(limnObj *obj, limnCamera *cam, Nrrd *nmap, limnWin *win) { char me[]="limnObjPSDraw", err[AIR_STRLEN_MED]; ! int inside; ! float angle; limnFace *f, *f0, *f1; int fi; limnEdge *e; int ei; *************** *** 190,193 **** --- 196,200 ---- r = &(obj->r[ri]); + /* only draw the parts that are inside the field of view */ inside = 0; for (pi=0; pi<r->pNum; pi++) { *************** *** 201,214 **** break; } - if (!inside) continue; if (1 == r->eNum) { /* this part is just one lone edge */ e = &(obj->e[r->eBase]); ! widthTmp = win->ps.edgeWidth[e->visib]; fprintf(win->file, "%g setgray\n", 1 - win->ps.bg[0]); ! win->ps.edgeWidth[e->visib] = 8; _limnPSDrawEdge(obj, r, e, cam, win); fprintf(win->file, "%g %g %g RGB\n", --- 208,223 ---- break; } if (!inside) continue; + /* draw the part */ if (1 == r->eNum) { /* this part is just one lone edge */ + /* HEY: this is a mess */ + /* e = &(obj->e[r->eBase]); ! widthTmp = win->ps.lineWidth[e->type]; fprintf(win->file, "%g setgray\n", 1 - win->ps.bg[0]); ! win->ps.edgeWidth[e->type] = 8; _limnPSDrawEdge(obj, r, e, cam, win); fprintf(win->file, "%g %g %g RGB\n", *************** *** 217,222 **** --- 226,234 ---- _limnPSDrawEdge(obj, r, e, cam, win); win->ps.edgeWidth[e->visib] = widthTmp; + */ } else { /* this part is either a lone face or a solid */ + + /* draw the front-facing, shaded faces */ for (fi=0; fi<r->fNum; fi++) { f = &(obj->f[r->fBase + fi]); *************** *** 234,244 **** ELL_3V_SCALE(f->wn, -1, f->wn); } ! if (f->visib) { _limnPSDrawFace(obj, r, f, cam, nmap, win); } } fprintf(win->file, "0 setgray\n"); - for (ei=0; ei<r->eNum; ei++) { e = &(obj->e[r->eBase + ei]); --- 246,256 ---- ELL_3V_SCALE(f->wn, -1, f->wn); } ! if (!win->ps.wireFrame && f->visib) { _limnPSDrawFace(obj, r, f, cam, nmap, win); } } + /* draw ALL edges */ fprintf(win->file, "0 setgray\n"); for (ei=0; ei<r->eNum; ei++) { e = &(obj->e[r->eBase + ei]); *************** *** 246,262 **** f1 = e->f1 != -1 ? &(obj->f[e->f1]) : NULL; if (!f1) { ! /* not clear what to do with perimeter of lone faces; ! for now: front-facing non-crease edge */ ! e->visib = 4; } else { - vis0 = f0->visib; - vis1 = f1->visib; angle = 180/M_PI*acos(ELL_3V_DOT(f0->wn, f1->wn)); ! if (vis0 && vis1) { ! e->visib = 4 - (angle > win->ps.creaseAngle); ! } else if (!!vis0 ^ !!vis1) { ! e->visib = 2; } else { ! e->visib = (angle > win->ps.creaseAngle); } } --- 258,274 ---- f1 = e->f1 != -1 ? &(obj->f[e->f1]) : NULL; if (!f1) { ! e->type = limnEdgeTypeBorder; } else { angle = 180/M_PI*acos(ELL_3V_DOT(f0->wn, f1->wn)); ! if (f0->visib && f1->visib) { ! e->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeFrontCrease ! : limnEdgeTypeFrontFacet); ! } else if (f0->visib ^ f1->visib) { ! e->type = limnEdgeTypeContour; } else { ! e->type = (angle > win->ps.creaseAngle ! ? limnEdgeTypeBackCrease ! : limnEdgeTypeBackFacet); } } *************** *** 270,271 **** --- 282,401 ---- return 0; } + + void + _limnPSDrawPointPair(limnObj *obj, limnPart *r, + int v0, int v1, int type, + limnCamera *cam, limnWin *win) { + + if (win->ps.lineWidth[type]) { + fprintf(win->file, "%g %g M ", obj->p[v0].d[0], obj->p[v0].d[1]); + fprintf(win->file, "%g %g L ", obj->p[v1].d[0], obj->p[v1].d[1]); + fprintf(win->file, "%g W ", win->ps.lineWidth[type]); + fprintf(win->file, "S\n"); + } + } + + /* + ** HEY: drawing non-convex objects has to be done one face at a time, + ** and faces are responsible for drawing their edges. The STUPID + ** thing about limn right now is that faces do not have a list of + ** their edges; only a list of their vertex indices... + */ + + /* + ******** limnObjPSDraw + ** + ** new version of the above, which works per-face instead of per-part + */ + int + limnObjPSDraw(limnObj *obj, limnCamera *cam, Nrrd *nmap, limnWin *win) { + char me[]="limnObjPSDraw", err[AIR_STRLEN_MED]; + int inside, vi, psize, v0, v1; + float angle; + limnFace *f, *f0, *f1; int fi; + limnEdge *e; int ei; + limnPart *r; int ri; + limnPoint *p; int pi; + Nrrd *neinfo; + unsigned char *einfo; + airArray *mop; + + if (nmap) { + if (limnEnvMapCheck(nmap)) { + sprintf(err, "%s: trouble", me); + biffAdd(LIMN, err); return 1; + } + } + + mop = airMopNew(); + neinfo = nrrdNew(); + airMopAdd(mop, neinfo, (airMopper)nrrdNuke, airMopAlways); + psize = obj->pA->len; + if (nrrdMaybeAlloc(neinfo, nrrdTypeUChar, 2, psize, psize)) { + sprintf(err, "%s: couldn't allocate %d x %d array of point pairs", + me, obj->pA->len, obj->pA->len); + biffMove(LIMN, err, NRRD); return 1; + } + einfo = (unsigned char*)(neinfo->data); + + limnObjDepthSortFaces(obj); + + _limnPSPreamble(obj, cam, win); + + /* categorize all edges by traversing edge array, and storing + edge type information in einfo[] */ + for (ei=0; ei<obj->eA->len; ei++) { + e = obj->e + ei; + if (e->v0 < e->v1) { + v0 = e->v0; + v1 = e->v1; + } else { + v0 = e->v1; + v1 = e->v0; + } + f0 = &(obj->f[e->f0]); + f1 = e->f1 != -1 ? &(obj->f[e->f1]) : NULL; + if (!f1) { + einfo[v0 + psize*v1] = limnEdgeTypeBorder; + } else { + angle = 180/M_PI*acos(ELL_3V_DOT(f0->wn, f1->wn)); + if (f0->visib && f1->visib) { + einfo[v0 + psize*v1] = (angle > win->ps.creaseAngle + ? limnEdgeTypeFrontCrease + : limnEdgeTypeFrontFacet); + } else if (f0->visib ^ f1->visib) { + einfo[v0 + psize*v1] = limnEdgeTypeContour; + } else { + einfo[v0 + psize*v1] = (angle > win->ps.creaseAngle + ? limnEdgeTypeBackCrease + : limnEdgeTypeBackFacet); + } + } + } + + /* draw front-faces and non-back edges */ + for (fi=0; fi<obj->fA->len; fi++) { + f = obj->f + obj->fSort[fi]; + f->visib = (cam->rightHanded + ? f->sn[2] < 0 + : f->sn[2] > 0); + if (f->vNum == r->pNum && !f->visib) { + f->visib = AIR_TRUE; + ELL_3V_SCALE(f->wn, -1, f->wn); + } + if (!win->ps.wireFrame && f->visib) { + _limnPSDrawFace(obj, r, f, cam, nmap, win); + } + /* + for (vi=0; vi<f->vNum; vi++) { + p = obj->p + obj->v[vi + f->vBase]; + fprintf(win->file, "%g %g %s\n", + p->d[0], p->d[1], vi ? "L" : "M"); + } + */ + } + + _limnPSEpilogue(obj, cam, win); + + return 0; + } Index: transform.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/transform.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** transform.c 7 Jan 2004 15:34:30 -0000 1.16 --- transform.c 9 Feb 2004 07:06:18 -0000 1.17 *************** *** 266,267 **** --- 266,304 ---- return 0; } + + limnFace *_limnFaceHack; + + int + _limnFaceDepthCompare(const void *_a, const void *_b) { + int *a; + int *b; + + a = (int *)_a; + b = (int *)_b; + return -AIR_COMPARE(_limnFaceHack[*a].z, _limnFaceHack[*b].z); + } + + int + limnObjDepthSortFaces(limnObj *obj) { + limnFace *f; + limnPoint *p; + int fi, vi; + + obj->fSort = (int*)calloc(obj->fA->len, sizeof(int)); + for (fi=0; fi<obj->fA->len; fi++) { + f = obj->f + fi; + f->z = 0; + for (vi=f->vBase; vi<f->vBase+f->vNum; vi++) { + p = obj->p + obj->v[vi]; + f->z += p->s[2]; + } + f->z /= f->vNum; + obj->fSort[fi] = fi; + } + + _limnFaceHack = obj->f; + qsort(obj->fSort, obj->fA->len, sizeof(int), _limnFaceDepthCompare); + + return 0; + } + |
|
From: <kin...@us...> - 2004-02-09 07:09:29
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28564/test Modified Files: light.c map.c Log Message: changed spelling of QN stuff: limnQN_xxx --> limnQNxxx added a few more checker-based normal quantization methods added simple and incomplete readers and writers for OFF file format added long-overdue enum for edge types (front vs. back, crease vs. non-crease, etc...) starting to add functionality to correctly draw non-convex objects and parts Index: light.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/light.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** light.c 7 Jan 2004 15:34:30 -0000 1.13 --- light.c 9 Feb 2004 07:06:19 -0000 1.14 *************** *** 50,54 **** if (limnEnvMapFill(map=nrrdNew(), limnLightDiffuseCB, ! limnQN_16checker, lit)) { fprintf(stderr, "%s: trouble:\n%s", me, biffGet(LIMN)); exit(1); --- 50,54 ---- if (limnEnvMapFill(map=nrrdNew(), limnLightDiffuseCB, ! limnQN16checker, lit)) { fprintf(stderr, "%s: trouble:\n%s", me, biffGet(LIMN)); exit(1); Index: map.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/map.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** map.c 7 Jan 2004 15:34:30 -0000 1.9 --- map.c 9 Feb 2004 07:06:19 -0000 1.10 *************** *** 42,46 **** me = argv[0]; ! if (limnEnvMapFill(map=nrrdNew(), cb, limnQN_16checker, NULL)) { fprintf(stderr, "%s: trouble:\n%s", me, biffGet(LIMN)); exit(1); --- 42,46 ---- me = argv[0]; ! if (limnEnvMapFill(map=nrrdNew(), cb, limnQN16checker, NULL)) { fprintf(stderr, "%s: trouble:\n%s", me, biffGet(LIMN)); exit(1); |
|
From: <kin...@us...> - 2004-02-09 07:08:46
|
Update of /cvsroot/teem/teem/src/limn/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28513/test Modified Files: soid.c Log Message: now outputs an OFF file, instead of doing the rendering itself Index: soid.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/test/soid.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** soid.c 7 Jan 2004 15:34:30 -0000 1.5 --- soid.c 9 Feb 2004 07:05:33 -0000 1.6 *************** *** 21,25 **** #include "../limn.h" ! char *info = ("Render a single ellipsoid in postscript."); void --- 21,25 ---- #include "../limn.h" ! char *info = ("Save a single ellipsoid or superquadric into an OFF file."); void *************** *** 53,57 **** main(int argc, char *argv[]) { char *me, *err, *outS; - limnCamera *cam; float p[3], q[4], mR[9], eval[3], len, sh, cl, cp, qA, qB; float matA[16], matB[16], os, sc[3], rad, edgeWidth[5]; --- 53,56 ---- *************** *** 61,92 **** limnSP *sp; limnPart *r; - limnWin *win; int ri, si, res, axis, sphere; ! Nrrd *nmap; mop = airMopNew(); - cam = limnCameraNew(); - airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); edgeWidth[0] = 0; edgeWidth[1] = 0; me = argv[0]; - hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"4 4 4", - "position of camera, used to determine view vector"); - hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0", - "camera look-at point, used to determine view vector"); - hestOptAdd(&hopt, "up", "up vector", airTypeDouble, 3, 3, cam->up, "0 0 1", - "camera pseudo-up vector, used to determine view coordinates"); - hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL, - "use a right-handed UVN frame (V points down)"); - hestOptAdd(&hopt, "or", NULL, airTypeInt, 0, 0, &(cam->orthographic), NULL, - "use orthogonal projection"); - hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange, - "-1 1", "range in U direction of image plane"); - hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, - "-1 1", "range in V direction of image plane"); - hestOptAdd(&hopt, "e", "envmap", airTypeOther, 1, 1, &nmap, NULL, - "16checker-based environment map", - NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, sc, "1 1 1", "axis-aligned scaling to do on ellipsoid"); --- 60,71 ---- limnSP *sp; limnPart *r; int ri, si, res, axis, sphere; ! FILE *file; mop = airMopNew(); edgeWidth[0] = 0; edgeWidth[1] = 0; me = argv[0]; hestOptAdd(&hopt, "sc", "scalings", airTypeFloat, 3, 3, sc, "1 1 1", "axis-aligned scaling to do on ellipsoid"); *************** *** 97,101 **** "function of differences between eigenvalues"); hestOptAdd(&hopt, "sphere", NULL, airTypeInt, 0, 0, &sphere, NULL, ! "none of this superquadric crap: use a sphere, dammit"); hestOptAdd(&hopt, "p", "x y z", airTypeFloat, 3, 3, p, "0 0 0", "location in quaternion quotient space"); --- 76,80 ---- "function of differences between eigenvalues"); hestOptAdd(&hopt, "sphere", NULL, airTypeInt, 0, 0, &sphere, NULL, ! "use a sphere instead of a superquadric"); hestOptAdd(&hopt, "p", "x y z", airTypeFloat, 3, 3, p, "0 0 0", "location in quaternion quotient space"); *************** *** 104,113 **** hestOptAdd(&hopt, "res", "resolution", airTypeInt, 1, 1, &res, "25", "tesselation resolution for both glyph and axis cylinders"); ! hestOptAdd(&hopt, "wd", "3 widths", airTypeFloat, 3, 3, edgeWidth + 2, ! "1.5 0.7 0.0", ! "width of edges drawn for three kinds of " ! "edges: silohuette, crease, non-crease"); ! hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps", ! "output file to render postscript into"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); --- 83,88 ---- hestOptAdd(&hopt, "res", "resolution", airTypeInt, 1, 1, &res, "25", "tesselation resolution for both glyph and axis cylinders"); ! hestOptAdd(&hopt, "o", "output OFF", airTypeString, 1, 1, &outS, "out.off", ! "output file to save OFF into"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); *************** *** 115,128 **** airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); - cam->neer = -0.000000001; - cam->dist = 0; - cam->faar = 0.0000000001; - cam->atRelative = AIR_TRUE; - - if (limnCameraUpdate(cam)) { - fprintf(stderr, "%s: trouble:\n%s\n", me, err = biffGet(LIMN)); - free(err); - return 1; - } obj = limnObjNew(10, AIR_TRUE); airMopAdd(mop, obj, (airMopper)limnObjNix, airMopAlways); --- 90,93 ---- *************** *** 131,139 **** si = airArrayIncrLen(obj->sA, 2); sp = obj->s + si + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); /* this is kind of silly */ ELL_3V_SET(sp->k, 0.2, 0.8, 0); sp->spec = 0; sp = obj->s + si + 1; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); /* this is kind of silly */ ELL_3V_SET(sp->k, 1, 0, 0); sp->spec = 0; --- 96,104 ---- si = airArrayIncrLen(obj->sA, 2); sp = obj->s + si + 0; ! ELL_4V_SET(sp->rgba, 1, 1, 1, 1); ELL_3V_SET(sp->k, 0.2, 0.8, 0); sp->spec = 0; sp = obj->s + si + 1; ! ELL_4V_SET(sp->rgba, 0, 0, 0, 1); ELL_3V_SET(sp->k, 1, 0, 0); sp->spec = 0; *************** *** 169,173 **** ri = limnObjPolarSuperquadAdd(obj, 0, axis, qA, qB, 2*res, res); } ! r = obj->r + ri; ELL_4V_SET(r->rgba, 1, 1, 1, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, sc[0], sc[1], sc[2]); --- 134,138 ---- ri = limnObjPolarSuperquadAdd(obj, 0, axis, qA, qB, 2*res, res); } ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, sc[0], sc[1], sc[2]); *************** *** 179,183 **** if (rad) { ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); --- 144,148 ---- if (rad) { ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); *************** *** 188,192 **** ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); --- 153,157 ---- ri = limnObjCylinderAdd(obj, 1, 0, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, (1-sc[0])/2, rad, rad); *************** *** 198,202 **** ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); --- 163,167 ---- ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); *************** *** 207,211 **** ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); --- 172,176 ---- ri = limnObjCylinderAdd(obj, 1, 1, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, (1-sc[1])/2, rad); *************** *** 215,221 **** limnObjPartTransform(obj, ri, matA); - ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); --- 180,185 ---- limnObjPartTransform(obj, ri, matA); ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); *************** *** 226,230 **** ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4V_SET(r->rgba, 0, 0, 0, 1); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); --- 190,194 ---- ri = limnObjCylinderAdd(obj, 1, 2, res); ! r = obj->r + ri; ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, rad, rad, (1-sc[2])/2); *************** *** 235,252 **** } ! win = limnWinNew(limnDevicePS); ! ELL_5V_COPY(win->ps.edgeWidth, edgeWidth); ! win->scale = 200; ! ! win->file = fopen(outS, "w"); ! airMopAdd(mop, win, (airMopper)limnWinNix, airMopAlways); ! if (limnObjRender(obj, cam, win) ! || limnObjPSDraw(obj, cam, nmap, win)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } - fclose(win->file); airMopOkay(mop); --- 199,210 ---- } ! file = airFopen(outS, stdout, "w"); ! airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); ! if (limnObjOFFWrite(file, obj)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } airMopOkay(mop); |