summaryrefslogtreecommitdiffstats
path: root/src/CompositeGeometryManager.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-01-14 10:39:43 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-01-14 10:39:43 +0100
commit86ed34e9a5fa408c9338cd5c2871f7f7953806b7 (patch)
tree18075b5cef0df3c4ed6833df8890d41cdfc3acef /src/CompositeGeometryManager.cpp
parente5edadc1db1eac9057ed6b726e1ce6b8e7126ed0 (diff)
downloadastra-86ed34e9a5fa408c9338cd5c2871f7f7953806b7.tar.gz
astra-86ed34e9a5fa408c9338cd5c2871f7f7953806b7.tar.bz2
astra-86ed34e9a5fa408c9338cd5c2871f7f7953806b7.tar.xz
astra-86ed34e9a5fa408c9338cd5c2871f7f7953806b7.zip
Fix projections parallel to XZ or YZ planes
The early-cutoff optimization in CompositeGeometryManager was failing to properly handle +/-Inf.
Diffstat (limited to 'src/CompositeGeometryManager.cpp')
-rw-r--r--src/CompositeGeometryManager.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp
index 9be4797..41f6319 100644
--- a/src/CompositeGeometryManager.cpp
+++ b/src/CompositeGeometryManager.cpp
@@ -247,6 +247,18 @@ CCompositeGeometryManager::CPart* CCompositeGeometryManager::CVolumePart::reduce
//ASTRA_DEBUG("coord extent: %f - %f", zmin, zmax);
+ // Clip both zmin and zmax to get rid of extreme (or infinite) values
+ // NB: When individual pz values are +/-Inf, the sign is determined
+ // by ray direction and on which side of the face the ray passes.
+ if (zmin < pGeom->getWindowMinZ() - 2*pixz)
+ zmin = pGeom->getWindowMinZ() - 2*pixz;
+ if (zmin > pGeom->getWindowMaxZ() + 2*pixz)
+ zmin = pGeom->getWindowMaxZ() + 2*pixz;
+ if (zmax < pGeom->getWindowMinZ() - 2*pixz)
+ zmax = pGeom->getWindowMinZ() - 2*pixz;
+ if (zmax > pGeom->getWindowMaxZ() + 2*pixz)
+ zmax = pGeom->getWindowMaxZ() + 2*pixz;
+
zmin = (zmin - pixz - pGeom->getWindowMinZ()) / pixz;
zmax = (zmax + pixz - pGeom->getWindowMinZ()) / pixz;