mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#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:
parent
c527545e4f
commit
04d70a9204
@ -433,31 +433,51 @@ void RiuViewerCommands::extractIntersectionData(const cvf::HitItemCollection& hi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cvf::Part* pickedPart = firstNonNncHitItem->part();
|
if (firstNonNncHitItem)
|
||||||
CVF_ASSERT(pickedPart);
|
|
||||||
*firstPart = const_cast<cvf::Part*>(pickedPart);
|
|
||||||
|
|
||||||
const cvf::Transform* xf = pickedPart->transform();
|
|
||||||
cvf::Vec3d globalPickedPoint = firstNonNncHitItem->intersectionPoint();
|
|
||||||
|
|
||||||
if (localIntersectionPoint)
|
|
||||||
{
|
{
|
||||||
if (xf)
|
const cvf::Part* pickedPart = firstNonNncHitItem->part();
|
||||||
|
CVF_ASSERT(pickedPart);
|
||||||
|
*firstPart = const_cast<cvf::Part*>(pickedPart);
|
||||||
|
|
||||||
|
const cvf::Transform* xf = pickedPart->transform();
|
||||||
|
cvf::Vec3d globalPickedPoint = firstNonNncHitItem->intersectionPoint();
|
||||||
|
|
||||||
|
if (localIntersectionPoint)
|
||||||
{
|
{
|
||||||
*localIntersectionPoint = globalPickedPoint.getTransformedPoint(xf->worldTransform().getInverted());
|
if (xf)
|
||||||
|
{
|
||||||
|
*localIntersectionPoint = globalPickedPoint.getTransformedPoint(xf->worldTransform().getInverted());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*localIntersectionPoint = globalPickedPoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (firstPartFaceHit)
|
||||||
{
|
{
|
||||||
*localIntersectionPoint = globalPickedPoint;
|
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(firstNonNncHitItem->detail());
|
||||||
|
if (detail)
|
||||||
|
{
|
||||||
|
*firstPartFaceHit = detail->faceIndex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (firstPartFaceHit)
|
|
||||||
{
|
{
|
||||||
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(firstNonNncHitItem->detail());
|
if (localIntersectionPoint && nncPart && *nncPart)
|
||||||
if (detail)
|
|
||||||
{
|
{
|
||||||
*firstPartFaceHit = detail->faceIndex();
|
cvf::Vec3d globalPickedPoint = firstItemIntersectionPoint;
|
||||||
|
|
||||||
|
const cvf::Transform* xf = (*nncPart)->transform();
|
||||||
|
if (xf)
|
||||||
|
{
|
||||||
|
*localIntersectionPoint = globalPickedPoint.getTransformedPoint(xf->worldTransform().getInverted());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*localIntersectionPoint = globalPickedPoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user