From 86ed34e9a5fa408c9338cd5c2871f7f7953806b7 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 14 Jan 2016 10:39:43 +0100 Subject: Fix projections parallel to XZ or YZ planes The early-cutoff optimization in CompositeGeometryManager was failing to properly handle +/-Inf. --- src/CompositeGeometryManager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; -- cgit v1.2.3