summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-01-14 11:06:31 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2016-01-14 11:06:31 +0100
commit13d945c0b2812a5a4958876a80378f4015b173bf (patch)
tree18075b5cef0df3c4ed6833df8890d41cdfc3acef
parente5edadc1db1eac9057ed6b726e1ce6b8e7126ed0 (diff)
parent86ed34e9a5fa408c9338cd5c2871f7f7953806b7 (diff)
downloadastra-13d945c0b2812a5a4958876a80378f4015b173bf.tar.gz
astra-13d945c0b2812a5a4958876a80378f4015b173bf.tar.bz2
astra-13d945c0b2812a5a4958876a80378f4015b173bf.tar.xz
astra-13d945c0b2812a5a4958876a80378f4015b173bf.zip
Merge pull request #109 from wjp/fix_zdir_proj
Fix projections parallel to XZ or YZ planes
-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;