(#260) Fixed problem with picking faults in some rare cases

Made sure that we handle the case when an item has been hit which is not
a non-NNC item.
This commit is contained in:
Pål Hagen 2015-06-30 12:05:24 +02:00
parent c527545e4f
commit 04d70a9204

View File

@ -433,6 +433,8 @@ void RiuViewerCommands::extractIntersectionData(const cvf::HitItemCollection& hi
}
}
if (firstNonNncHitItem)
{
const cvf::Part* pickedPart = firstNonNncHitItem->part();
CVF_ASSERT(pickedPart);
*firstPart = const_cast<cvf::Part*>(pickedPart);
@ -461,6 +463,24 @@ void RiuViewerCommands::extractIntersectionData(const cvf::HitItemCollection& hi
}
}
}
else
{
if (localIntersectionPoint && nncPart && *nncPart)
{
cvf::Vec3d globalPickedPoint = firstItemIntersectionPoint;
const cvf::Transform* xf = (*nncPart)->transform();
if (xf)
{
*localIntersectionPoint = globalPickedPoint.getTransformedPoint(xf->worldTransform().getInverted());
}
else
{
*localIntersectionPoint = globalPickedPoint;
}
}
}
}
//--------------------------------------------------------------------------------------------------
///