|
From: <kin...@us...> - 2023-07-22 04:12:34
|
Revision: 7136
http://sourceforge.net/p/teem/code/7136
Author: kindlmann
Date: 2023-07-22 03:55:59 +0000 (Sat, 22 Jul 2023)
Log Message:
-----------
API CHANGE: adding another field to seekContext, to record the average (world-space) gradient magnitude, over the vertices in an isosurface (when there isn't a gageContext), with the hope that it is useful for some signed distance field computations. Also noting that Thomas Schultz commited some work to this file (other files in seek have a similar copyright attribution)
Modified Paths:
--------------
teem/trunk/src/seek/extract.c
Modified: teem/trunk/src/seek/extract.c
===================================================================
--- teem/trunk/src/seek/extract.c 2023-07-22 03:51:29 UTC (rev 7135)
+++ teem/trunk/src/seek/extract.c 2023-07-22 03:55:59 UTC (rev 7136)
@@ -1,6 +1,7 @@
/*
Teem: Tools to process and visualize scientific data and images
Copyright (C) 2009--2023 University of Chicago
+ Copyright (C) 2009, 2011 Thomas Schultz
Copyright (C) 2005--2008 Gordon Kindlmann
Copyright (C) 1998--2004 University of Utah
@@ -825,6 +826,9 @@
if (sctx->normAns) {
gageProbe(sctx->gctx, tvertB[0], tvertB[1], tvertB[2]);
ELL_3V_SCALE_TT(lpld->norm + 3 * ovi, float, -1, sctx->normAns);
+ /* alas we can't increment sctx->gradMagAvg here because we only have the
+ * already-normalized normal, and updateSeek.c/updateAnswerPointers()
+ * actually prevents us from setting a gradAns if we wanted to */
if (sctx->reverse) {
ELL_3V_SCALE(lpld->norm + 3 * ovi, -1, lpld->norm + 3 * ovi);
}
@@ -832,6 +836,7 @@
ELL_3V_LERP(grad, ww, vgrad[vi0], vgrad[vi1]);
ELL_3MV_MUL(tvec, sctx->txfNormal, grad);
ELL_3V_NORM_TT(lpld->norm + 3 * ovi, float, tvec, tlen);
+ sctx->gradMagAvg += tlen;
}
}
sctx->vertNum++;
@@ -889,6 +894,9 @@
return 1;
}
+ sctx->gradMagAvg = 0; /* initalize per-vert accumulator, even though it will be
+ incremented in a narrow range of circumstances (such as:
+ isocontours without a gageContext) */
if (sctx->verbose > 2) {
fprintf(stderr, "%s: extracting ... ", me);
}
@@ -913,6 +921,9 @@
if (sctx->verbose > 2) {
fprintf(stderr, "%s\n", airDoneStr(0, zi, sz - 2, done));
}
+ if (sctx->vertNum) {
+ sctx->gradMagAvg /= sctx->vertNum;
+ }
/* this cleans up the airArrays in bag */
baggageNix(bag);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|