#4012 Add assert to the well path element intersections

This commit is contained in:
Gaute Lindkvist 2019-02-01 07:50:52 +01:00
parent e689b7ceaf
commit b4231775ef
2 changed files with 14 additions and 2 deletions

View File

@ -108,7 +108,7 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent&
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(
md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination); md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination);
} }
else else if (isGridSourceObject(firstPickItem.sourceInfo()))
{ {
targetPointInDomain = intersectionPointInDomain; targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false; doSetAzimuthAndInclination = false;
@ -118,6 +118,7 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent&
cvf::Vec3d domainRayEnd = targetPointInDomain + (targetPointInDomain - domainRayOrigin); cvf::Vec3d domainRayEnd = targetPointInDomain + (targetPointInDomain - domainRayOrigin);
cvf::Vec3d hexElementIntersection = findHexElementIntersection(rimView, firstPickItem, domainRayOrigin, domainRayEnd); cvf::Vec3d hexElementIntersection = findHexElementIntersection(rimView, firstPickItem, domainRayOrigin, domainRayEnd);
CVF_TIGHT_ASSERT(!hexElementIntersection.isUndefined());
if (!hexElementIntersection.isUndefined()) if (!hexElementIntersection.isUndefined())
{ {
targetPointInDomain = hexElementIntersection; targetPointInDomain = hexElementIntersection;
@ -221,6 +222,16 @@ bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd(do
return false; return false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::isGridSourceObject(const cvf::Object* object)
{
auto sourceInfo = dynamic_cast<const RivSourceInfo*>(object);
auto femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(object);
return sourceInfo || femSourceInfo;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -285,7 +296,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection(Rim3
return (lhs.m_intersectionPoint - domainRayOrigin).lengthSquared() < (rhs.m_intersectionPoint - domainRayOrigin).lengthSquared(); return (lhs.m_intersectionPoint - domainRayOrigin).lengthSquared() < (rhs.m_intersectionPoint - domainRayOrigin).lengthSquared();
} }
); );
const double eps = 1.0e-3; const double eps = 1.0e-2;
cvf::Vec3d intersectionRay = intersectionInfo.back().m_intersectionPoint - intersectionInfo.front().m_intersectionPoint; cvf::Vec3d intersectionRay = intersectionInfo.back().m_intersectionPoint - intersectionInfo.front().m_intersectionPoint;
cvf::Vec3d newPoint = intersectionInfo.front().m_intersectionPoint + intersectionRay * eps; cvf::Vec3d newPoint = intersectionInfo.front().m_intersectionPoint + intersectionRay * eps;
CVF_ASSERT(RigHexIntersectionTools::isPointInCell(newPoint, cornerVertices.data())); CVF_ASSERT(RigHexIntersectionTools::isPointInCell(newPoint, cornerVertices.data()));

View File

@ -44,6 +44,7 @@ private:
double* azimuth, double* azimuth,
double* inclination) const; double* inclination) const;
static bool isGridSourceObject(const cvf::Object* object);
static cvf::Vec3d findHexElementIntersection(Rim3dView* view, const RiuPickItemInfo& pickItem, const cvf::Vec3d& domainRayOrigin, const cvf::Vec3d& domainRayEnd); static cvf::Vec3d findHexElementIntersection(Rim3dView* view, const RiuPickItemInfo& pickItem, const cvf::Vec3d& domainRayOrigin, const cvf::Vec3d& domainRayEnd);
private: private:
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo; caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;