(#676) Start intersections of well paths when the trajectory enters the active cells bounding box.

This commit is contained in:
Jacob Støren 2015-11-27 11:27:06 +01:00
parent f8d3b85047
commit 9fff7825af
2 changed files with 48 additions and 2 deletions

View File

@ -259,6 +259,7 @@ std::vector< std::vector <cvf::Vec3d> > RimCrossSection::polyLines() const
if (wellPath())
{
lines.push_back(wellPath->wellPathGeometry()->m_wellPathPoints);
clipToReservoir(lines[0]);
}
}
else if (type == CS_SIMULATION_WELL)
@ -289,8 +290,6 @@ std::vector< std::vector <cvf::Vec3d> > RimCrossSection::polyLines() const
{
std::vector<cvf::Vec3d>& polyLine = lines[lIdx];
addExtents(polyLine);
}
}
@ -423,3 +422,49 @@ void RimCrossSection::updateName()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCrossSection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const
{
RimCase* ownerCase = NULL;
firstAnchestorOrThisOfType(ownerCase);
std::vector<cvf::Vec3d> clippedPolyLine;
if (ownerCase)
{
cvf::BoundingBox caseBB = ownerCase->activeCellsBoundingBox();
bool hasEnteredReservoirBB = false;
for (size_t vxIdx = 0 ; vxIdx < polyLine.size(); ++vxIdx)
{
if (!caseBB.contains(polyLine[vxIdx]))
{
continue;
}
if (!hasEnteredReservoirBB)
{
if (vxIdx > 0)
{
// clip line, and add vx to start
cvf::Plane topPlane;
topPlane.setFromPointAndNormal(caseBB.max(), cvf::Vec3d::Z_AXIS);
cvf::Vec3d intersection;
if (topPlane.intersect(polyLine[vxIdx-1], polyLine[vxIdx], &intersection))
{
clippedPolyLine.push_back(intersection);
}
}
hasEnteredReservoirBB = true;
}
clippedPolyLine.push_back(polyLine[vxIdx]);
}
}
polyLine.swap(clippedPolyLine);
}

View File

@ -88,6 +88,7 @@ private:
void updateWellCenterline() const;
void updateWellExtentDefaultValue();
void addExtents(std::vector<cvf::Vec3d> &polyLine) const;
void clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const;
void updateName();
private:
cvf::ref<RivCrossSectionPartMgr> m_crossSectionPartMgr;