Text archives Help
- From: knolla@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1065 - trunk/Model/Primitives
- Date: Tue, 16 May 2006 17:36:21 -0600 (MDT)
Author: knolla
Date: Tue May 16 17:36:20 2006
New Revision: 1065
Modified:
trunk/Model/Primitives/IsosurfaceOctreeVolume.h
trunk/Model/Primitives/OctreeVolume.cc
trunk/Model/Primitives/OctreeVolume.h
Log:
build compiles on OS X -- let's try on Linux
Modified: trunk/Model/Primitives/IsosurfaceOctreeVolume.h
==============================================================================
--- trunk/Model/Primitives/IsosurfaceOctreeVolume.h (original)
+++ trunk/Model/Primitives/IsosurfaceOctreeVolume.h Tue May 16 17:36:20
2006
@@ -47,6 +47,8 @@
const Vector& orig, const Vector& dir, const
Vector& inv_dir, int res,
int depth, int cap_index, unsigned int
index_trace[], Vec3i& cell, const float tenter,
const float texit) const;
+
+ //lookup returning 0 if out of bounds. Only
works for scalar datatypes.
};
};
Modified: trunk/Model/Primitives/OctreeVolume.cc
==============================================================================
--- trunk/Model/Primitives/OctreeVolume.cc (original)
+++ trunk/Model/Primitives/OctreeVolume.cc Tue May 16 17:36:20 2006
@@ -266,7 +266,7 @@
Vec3i dp((2*i + pi) *
dim_extents,
(2*j + pj) *
dim_extents,
(2*k + pk) *
dim_extents);
- ST odval =
originalData.lookup_safe(dp.data[0], dp.data[1], dp.data[2]);
+ ST odval =
lookup_safe(originalData, dp.data[0], dp.data[1], dp.data[2]);
narrow_range(odval, isomin,
isomax);
bnode.values[4*pi | 2*pj | pk] =
odval;
}
@@ -313,8 +313,12 @@
// 3 = this node, 1 forward, 1 backward
(central differences)
// 4 = this, 2 forward, 1 backward.
// etc.
- Vec3i kmin(2*i, 2*j, 2*k);
- Vec3i kmax(kmin);
+ Vec3i kmin;
+ kmin.data[0] = 2*i;
+ kmin.data[1] = 2*j;
+ kmin.data[2] = 2*k;
+ Vec3i kmax = kmin;
+
kmin -= (kernel_width-1)/2;
kmax += (kernel_width/2)+1;
bnode.min = bnode.max = bnode.values[0];
@@ -324,7 +328,7 @@
for(int pj=kmin.data[1];
pj<=kmax.data[1]; pj++)
for(int pk=kmin.data[2];
pk<=kmax.data[2]; pk++)
{
- ST val =
originalData.lookup_safe(pi, pj, pk);
+ ST val =
lookup_safe(originalData, pi, pj, pk);
narrow_range(val,
isomin, isomax);
bnode.min =
MIN(bnode.min, val);
bnode.max =
MAX(bnode.max, val);
Modified: trunk/Model/Primitives/OctreeVolume.h
==============================================================================
--- trunk/Model/Primitives/OctreeVolume.h (original)
+++ trunk/Model/Primitives/OctreeVolume.h Tue May 16 17:36:20 2006
@@ -436,6 +436,15 @@
bool read_file(std::string filebase);
bool write_file(std::string filebase);
+
+ private:
+ inline ST lookup_safe(SCIRun::Array3<ST>& originalData, int d1, int
d2, int d3) const
+ {
+ if (d1>=0 && d1<originalData.dim1() && d2>=0 &&
d2<originalData.dim2() && d3>=0 && d3<originalData.dim3())
+ return originalData(d1, d2, d3);
+ else
+ return 0;
+ }
};
};
- [MANTA] r1065 - trunk/Model/Primitives, knolla, 05/16/2006
Archive powered by MHonArc 2.6.16.