#1901 Fix wrong calculation of perforation points along wellpath

This commit is contained in:
Jacob Støren
2017-09-18 16:24:29 +02:00
parent 9f47226049
commit d4315f7ccf
2 changed files with 14 additions and 38 deletions

View File

@@ -200,20 +200,12 @@ void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewD
if (currentViewDate.isValid() && !perforation->isActiveOnDate(currentViewDate)) continue; if (currentViewDate.isValid() && !perforation->isActiveOnDate(currentViewDate)) continue;
std::vector<cvf::Vec3d> displayCoords; std::vector<cvf::Vec3d> displayCoords = wellPathGeometry->clippedPointSubset(perforation->startMD(), perforation->endMD());
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->startMD())));
for (size_t i = 0; i < wellPathGeometry->m_measuredDepths.size(); ++i)
{
double measuredDepth = wellPathGeometry->m_measuredDepths[i];
if (measuredDepth > perforation->startMD() && measuredDepth < perforation->endMD())
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->m_wellPathPoints[i]));
}
}
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->endMD())));
if (displayCoords.size() < 2) continue; if (displayCoords.size() < 2) continue;
for (cvf::Vec3d& point : displayCoords) point = displayCoordTransform->transformToDisplayCoord(point);
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(perforation); cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(perforation);
cvf::Collection<cvf::Part> parts; cvf::Collection<cvf::Part> parts;

View File

@@ -198,33 +198,17 @@ std::vector<cvf::Vec3d> RigWellPath::clippedPointSubset(double startMD, double e
if (m_measuredDepths.empty()) return points; if (m_measuredDepths.empty()) return points;
if (startMD > endMD) return points; if (startMD > endMD) return points;
size_t i = 0; points.push_back(interpolatedPointAlongWellPath(startMD));
// Skip points below startMD for (size_t i = 0; i < m_measuredDepths.size(); ++i)
while (i < m_measuredDepths.size() && m_measuredDepths[i] < startMD) ++i; {
double measuredDepth = m_measuredDepths[i];
if (measuredDepth > startMD && measuredDepth < endMD)
{
points.push_back(m_wellPathPoints[i]);
}
}
points.push_back(interpolatedPointAlongWellPath(endMD));
if (i == 0)
{
// If startMD is at or below the starting MD, use that point
points.push_back(m_wellPathPoints[0]);
}
else
{
double stepsize = (startMD - m_measuredDepths[i - 1]) / (m_measuredDepths[i] - m_measuredDepths[i - 1]);
points.push_back(m_wellPathPoints[i - 1] + stepsize * (m_wellPathPoints[i] - m_wellPathPoints[i - 1]));
}
while (i < m_measuredDepths.size() && m_measuredDepths[i] < endMD)
{
// Add all points between startMD and endMD
points.push_back(m_wellPathPoints[i]);
++i;
}
if (i < m_measuredDepths.size() && m_measuredDepths[i] > endMD)
{
double stepsize = (endMD - m_measuredDepths[i - 1]) / (m_measuredDepths[i] - m_measuredDepths[i - 1]);
points.push_back(m_wellPathPoints[i - 1] + stepsize * (m_wellPathPoints[i] - m_wellPathPoints[i - 1]));
}
return points; return points;
} }