Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RigWellPath.h"
|
|
|
|
|
2017-05-05 04:21:40 -05:00
|
|
|
#include "cvfGeometryTools.h"
|
2018-03-20 07:12:20 -05:00
|
|
|
#include "cvfBoundingBox.h"
|
|
|
|
#include "cvfPlane.h"
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2016-10-25 07:56:26 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigWellPath::RigWellPath()
|
|
|
|
: m_hasDatumElevation(false),
|
|
|
|
m_datumElevation(0.0)
|
|
|
|
{
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-25 07:56:26 -05:00
|
|
|
void RigWellPath::setDatumElevation(double value)
|
|
|
|
{
|
|
|
|
m_hasDatumElevation = true;
|
|
|
|
m_datumElevation = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RigWellPath::hasDatumElevation() const
|
|
|
|
{
|
|
|
|
return m_hasDatumElevation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RigWellPath::datumElevation() const
|
|
|
|
{
|
|
|
|
return m_datumElevation;
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
|
2018-06-29 04:23:59 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RigWellPath::rkbDiff() const
|
|
|
|
{
|
|
|
|
if (hasDatumElevation())
|
|
|
|
{
|
|
|
|
return datumElevation();
|
|
|
|
}
|
|
|
|
|
|
|
|
// If measured depth is zero, use the z-value of the well path points
|
|
|
|
if (m_wellPathPoints.size() > 0 && m_measuredDepths.size() > 0)
|
|
|
|
{
|
|
|
|
double epsilon = 1e-3;
|
|
|
|
|
|
|
|
if (cvf::Math::abs(m_measuredDepths[0]) < epsilon)
|
|
|
|
{
|
|
|
|
double diff = m_measuredDepths[0] - (-wellPathPoints()[0].z());
|
|
|
|
|
|
|
|
return diff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return HUGE_VAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-04 06:29:25 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-27 02:55:28 -05:00
|
|
|
cvf::Vec3d RigWellPath::interpolatedVectorValuesAlongWellPath(const std::vector<cvf::Vec3d>& vectorValuesAlongWellPath,
|
2018-04-13 07:35:14 -05:00
|
|
|
double measuredDepth,
|
|
|
|
double * horizontalLengthAlongWellToStartClipPoint /*= nullptr*/) const
|
2017-01-04 06:29:25 -06:00
|
|
|
{
|
2018-09-27 02:55:28 -05:00
|
|
|
CVF_ASSERT(vectorValuesAlongWellPath.size() == m_wellPathPoints.size());
|
2018-04-13 07:35:14 -05:00
|
|
|
cvf::Vec3d interpolatedVector = cvf::Vec3d::ZERO;
|
2017-01-04 06:29:25 -06:00
|
|
|
|
2018-03-20 11:28:27 -05:00
|
|
|
if (horizontalLengthAlongWellToStartClipPoint) *horizontalLengthAlongWellToStartClipPoint = 0.0;
|
|
|
|
|
|
|
|
size_t vxIdx = 0;
|
|
|
|
while ( vxIdx < m_measuredDepths.size() && m_measuredDepths.at(vxIdx) < measuredDepth )
|
2017-01-04 06:29:25 -06:00
|
|
|
{
|
2018-03-20 11:28:27 -05:00
|
|
|
if ( vxIdx > 0 && horizontalLengthAlongWellToStartClipPoint)
|
|
|
|
{
|
|
|
|
cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx-1];
|
|
|
|
segment[2] = 0.0;
|
|
|
|
*horizontalLengthAlongWellToStartClipPoint += segment.length();
|
|
|
|
}
|
|
|
|
vxIdx++;
|
2017-01-04 06:29:25 -06:00
|
|
|
}
|
|
|
|
|
2018-03-20 11:28:27 -05:00
|
|
|
if ( m_measuredDepths.size() > vxIdx )
|
2017-01-04 06:29:25 -06:00
|
|
|
{
|
2018-03-20 11:28:27 -05:00
|
|
|
if ( vxIdx == 0 )
|
2017-01-04 06:29:25 -06:00
|
|
|
{
|
2017-01-04 07:09:40 -06:00
|
|
|
//For measuredDepth same or lower than first point, use this first point
|
2018-09-27 02:55:28 -05:00
|
|
|
interpolatedVector = vectorValuesAlongWellPath.at(0);
|
2017-01-04 06:29:25 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Do interpolation
|
2018-03-20 11:28:27 -05:00
|
|
|
double segmentFraction = (measuredDepth - m_measuredDepths.at(vxIdx-1)) /
|
|
|
|
(m_measuredDepths.at(vxIdx) - m_measuredDepths.at(vxIdx - 1));
|
2018-04-13 07:35:14 -05:00
|
|
|
cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx - 1];
|
2018-09-27 02:55:28 -05:00
|
|
|
interpolatedVector = (1.0 - segmentFraction) * vectorValuesAlongWellPath[vxIdx - 1] + segmentFraction * vectorValuesAlongWellPath[vxIdx];
|
2018-03-20 11:28:27 -05:00
|
|
|
|
|
|
|
if ( horizontalLengthAlongWellToStartClipPoint )
|
|
|
|
{
|
|
|
|
segment[2] = 0.0;
|
2018-09-27 02:48:08 -05:00
|
|
|
*horizontalLengthAlongWellToStartClipPoint += segment.length() * segmentFraction;
|
2018-03-20 11:28:27 -05:00
|
|
|
}
|
2017-01-04 06:29:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-20 11:28:27 -05:00
|
|
|
// Use endpoint if measuredDepth same or higher than last point
|
2018-09-27 02:55:28 -05:00
|
|
|
interpolatedVector = vectorValuesAlongWellPath.at(vxIdx-1);
|
2017-01-04 06:29:25 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-13 07:35:14 -05:00
|
|
|
return interpolatedVector;
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, double * horizontalLengthAlongWellToStartClipPoint /*= nullptr*/) const
|
|
|
|
{
|
2018-09-27 02:55:28 -05:00
|
|
|
return interpolatedVectorValuesAlongWellPath(m_wellPathPoints, measuredDepth, horizontalLengthAlongWellToStartClipPoint);
|
2017-01-04 06:29:25 -06:00
|
|
|
}
|
|
|
|
|
2017-02-06 06:12:56 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
|
|
|
|
{
|
|
|
|
size_t closestIndex = cvf::UNDEFINED_SIZE_T;
|
|
|
|
double closestDistance = cvf::UNDEFINED_DOUBLE;
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
for ( size_t i = 1; i < m_wellPathPoints.size(); i++ )
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d p1 = m_wellPathPoints[i - 1];
|
|
|
|
cvf::Vec3d p2 = m_wellPathPoints[i - 0];
|
|
|
|
|
|
|
|
double candidateDistance = cvf::GeometryTools::linePointSquareDist(p1, p2, position);
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( candidateDistance < closestDistance )
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
|
|
|
closestDistance = candidateDistance;
|
|
|
|
closestIndex = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-02 04:36:46 -05:00
|
|
|
//For vertical well (x-component of direction = 0) returned angle will be 90.
|
2018-01-04 12:31:44 -06:00
|
|
|
double azimuthAngleDegrees = 90.0;
|
2017-02-06 06:12:56 -06:00
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( closestIndex != cvf::UNDEFINED_DOUBLE )
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d p1;
|
|
|
|
cvf::Vec3d p2;
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( closestIndex > 0 )
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
|
|
|
p1 = m_wellPathPoints[closestIndex - 1];
|
|
|
|
p2 = m_wellPathPoints[closestIndex - 0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p1 = m_wellPathPoints[closestIndex + 1];
|
|
|
|
p2 = m_wellPathPoints[closestIndex + 0];
|
|
|
|
}
|
|
|
|
|
2017-06-27 07:11:55 -05:00
|
|
|
cvf::Vec3d direction = p2 - p1;
|
2017-02-06 06:12:56 -06:00
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( fabs(direction.y()) > 1e-5 )
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
2017-06-27 07:11:55 -05:00
|
|
|
double atanValue = direction.x() / direction.y();
|
2018-01-04 12:31:44 -06:00
|
|
|
double azimuthRadians = atan(atanValue);
|
|
|
|
azimuthAngleDegrees = cvf::Math::toDegrees(azimuthRadians);
|
2017-02-06 06:12:56 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-04 12:31:44 -06:00
|
|
|
return azimuthAngleDegrees;
|
2017-02-06 06:12:56 -06:00
|
|
|
}
|
|
|
|
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigWellPath::twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(p1 && p2);
|
|
|
|
|
|
|
|
size_t closestIndex = cvf::UNDEFINED_SIZE_T;
|
|
|
|
double closestDistance = cvf::UNDEFINED_DOUBLE;
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
for ( size_t i = 1; i < m_wellPathPoints.size(); i++ )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2018-09-24 14:20:35 -05:00
|
|
|
cvf::Vec3d point1 = m_wellPathPoints[i - 1];
|
|
|
|
cvf::Vec3d point2 = m_wellPathPoints[i - 0];
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2018-09-24 14:20:35 -05:00
|
|
|
double candidateDistance = cvf::GeometryTools::linePointSquareDist(point1, point2, position);
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( candidateDistance < closestDistance )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
closestDistance = candidateDistance;
|
|
|
|
closestIndex = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-20 02:26:28 -05:00
|
|
|
if (closestIndex != cvf::UNDEFINED_SIZE_T)
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( closestIndex > 0 )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
*p1 = m_wellPathPoints[closestIndex - 1];
|
|
|
|
*p2 = m_wellPathPoints[closestIndex - 0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*p1 = m_wellPathPoints[closestIndex + 1];
|
|
|
|
*p2 = m_wellPathPoints[closestIndex + 0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-26 05:37:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-20 11:28:27 -05:00
|
|
|
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > RigWellPath::clippedPointSubset(double startMD,
|
|
|
|
double endMD,
|
|
|
|
double * horizontalLengthAlongWellToStartClipPoint) const
|
2017-05-26 05:37:01 -05:00
|
|
|
{
|
2017-09-19 10:20:49 -05:00
|
|
|
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > pointsAndMDs;
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( m_measuredDepths.empty() ) return pointsAndMDs;
|
|
|
|
if ( startMD > endMD ) return pointsAndMDs;
|
2017-09-19 10:20:49 -05:00
|
|
|
|
2018-03-20 11:28:27 -05:00
|
|
|
pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(startMD, horizontalLengthAlongWellToStartClipPoint));
|
2017-09-19 10:20:49 -05:00
|
|
|
pointsAndMDs.second.push_back(startMD);
|
2017-05-26 05:37:01 -05:00
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
for ( size_t i = 0; i < m_measuredDepths.size(); ++i )
|
2017-05-26 05:37:01 -05:00
|
|
|
{
|
2017-09-18 09:24:29 -05:00
|
|
|
double measuredDepth = m_measuredDepths[i];
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( measuredDepth > startMD && measuredDepth < endMD )
|
2017-09-18 09:24:29 -05:00
|
|
|
{
|
2017-09-19 10:20:49 -05:00
|
|
|
pointsAndMDs.first.push_back(m_wellPathPoints[i]);
|
|
|
|
pointsAndMDs.second.push_back(measuredDepth);
|
2017-09-18 09:24:29 -05:00
|
|
|
}
|
2017-05-26 05:37:01 -05:00
|
|
|
}
|
2017-09-19 10:20:49 -05:00
|
|
|
pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(endMD));
|
|
|
|
pointsAndMDs.second.push_back(endMD);
|
2017-05-26 05:37:01 -05:00
|
|
|
|
|
|
|
|
2017-09-19 10:20:49 -05:00
|
|
|
return pointsAndMDs;
|
2017-05-26 05:37:01 -05:00
|
|
|
}
|
|
|
|
|
2017-08-02 04:13:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-16 00:54:03 -06:00
|
|
|
std::vector<cvf::Vec3d> RigWellPath::wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
|
|
|
std::vector<cvf::Vec3d> points;
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( m_measuredDepths.empty() ) return points;
|
2017-08-02 04:13:27 -05:00
|
|
|
|
2018-01-16 00:54:03 -06:00
|
|
|
cvf::Vec3d interpolatedWellPathPoint = interpolatedPointAlongWellPath(intersectionMeasuredDepth);
|
2017-08-02 04:13:27 -05:00
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
for ( size_t i = 0; i < m_measuredDepths.size() - 1; i++ )
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( m_measuredDepths[i] == intersectionMeasuredDepth )
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
2018-01-16 00:54:03 -06:00
|
|
|
}
|
2018-03-20 07:12:20 -05:00
|
|
|
else if ( m_measuredDepths[i] < intersectionMeasuredDepth )
|
2018-01-16 00:54:03 -06:00
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( m_measuredDepths[i + 1] > intersectionMeasuredDepth )
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-01-16 00:54:03 -06:00
|
|
|
points.push_back(interpolatedWellPathPoint);
|
2017-08-02 04:13:27 -05:00
|
|
|
}
|
|
|
|
}
|
2018-03-20 07:12:20 -05:00
|
|
|
else if ( m_measuredDepths[i] > intersectionMeasuredDepth )
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-03-20 07:12:20 -05:00
|
|
|
if ( i == 0 )
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-01-16 00:54:03 -06:00
|
|
|
points.push_back(interpolatedWellPathPoint);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
2017-08-02 04:13:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
points.push_back(m_wellPathPoints.back());
|
|
|
|
|
|
|
|
return points;
|
|
|
|
}
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-23 16:06:21 -05:00
|
|
|
bool RigWellPath::isAnyPointInsideBoundingBox(const std::vector<cvf::Vec3d>& points, const cvf::BoundingBox& boundingBox)
|
2018-03-20 07:12:20 -05:00
|
|
|
{
|
2018-04-23 16:06:21 -05:00
|
|
|
for (const cvf::Vec3d& point : points)
|
2018-03-20 07:12:20 -05:00
|
|
|
{
|
2018-04-23 16:06:21 -05:00
|
|
|
if (boundingBox.contains(point)) return true;
|
2018-03-20 07:12:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ(const std::vector<cvf::Vec3d>& polyLine,
|
|
|
|
double maxZ,
|
2018-03-21 07:56:24 -05:00
|
|
|
double * horizontalLengthAlongWellToClipPoint,
|
|
|
|
size_t * indexToFirstVisibleSegment)
|
2018-03-20 07:12:20 -05:00
|
|
|
{
|
2018-03-21 07:56:24 -05:00
|
|
|
CVF_ASSERT(horizontalLengthAlongWellToClipPoint);
|
|
|
|
CVF_ASSERT(indexToFirstVisibleSegment);
|
2018-03-20 07:12:20 -05:00
|
|
|
|
|
|
|
// Find first visible point, and accumulate distance along wellpath
|
|
|
|
|
|
|
|
*horizontalLengthAlongWellToClipPoint = 0.0;
|
2018-03-21 07:56:24 -05:00
|
|
|
*indexToFirstVisibleSegment = cvf::UNDEFINED_SIZE_T;
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
size_t firstVisiblePointIndex = cvf::UNDEFINED_SIZE_T;
|
|
|
|
|
|
|
|
for ( size_t vxIdx = 0 ; vxIdx < polyLine.size(); ++vxIdx )
|
|
|
|
{
|
|
|
|
if ( polyLine[vxIdx].z() > maxZ )
|
|
|
|
{
|
|
|
|
if ( vxIdx > 0 )
|
|
|
|
{
|
|
|
|
cvf::Vec3d segment = polyLine[vxIdx] - polyLine[vxIdx-1];
|
|
|
|
segment[2] = 0.0;
|
|
|
|
*horizontalLengthAlongWellToClipPoint += segment.length();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
firstVisiblePointIndex = vxIdx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clip line, and add vx to the start of the clipped result
|
|
|
|
|
|
|
|
std::vector<cvf::Vec3d> clippedPolyLine;
|
|
|
|
|
|
|
|
if ( firstVisiblePointIndex == cvf::UNDEFINED_SIZE_T )
|
|
|
|
{
|
|
|
|
return clippedPolyLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( firstVisiblePointIndex > 0 )
|
|
|
|
{
|
|
|
|
|
|
|
|
cvf::Plane topPlane;
|
|
|
|
topPlane.setFromPointAndNormal({ 0.0, 0.0, maxZ }, cvf::Vec3d::Z_AXIS);
|
|
|
|
cvf::Vec3d intersection;
|
|
|
|
|
|
|
|
if ( topPlane.intersect(polyLine[firstVisiblePointIndex-1],
|
|
|
|
polyLine[firstVisiblePointIndex],
|
|
|
|
&intersection) )
|
|
|
|
{
|
|
|
|
cvf::Vec3d segment = intersection - polyLine[firstVisiblePointIndex-1];
|
|
|
|
segment[2] = 0.0;
|
|
|
|
*horizontalLengthAlongWellToClipPoint += segment.length();
|
|
|
|
|
|
|
|
clippedPolyLine.push_back(intersection);
|
|
|
|
}
|
|
|
|
|
2018-03-21 07:56:24 -05:00
|
|
|
*indexToFirstVisibleSegment = firstVisiblePointIndex - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*indexToFirstVisibleSegment = 0;
|
|
|
|
}
|
|
|
|
|
2018-03-20 07:12:20 -05:00
|
|
|
// Add the rest of the polyline
|
|
|
|
|
|
|
|
for ( size_t vxIdx = firstVisiblePointIndex; vxIdx < polyLine.size(); ++vxIdx )
|
|
|
|
{
|
|
|
|
clippedPolyLine.push_back(polyLine[vxIdx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return clippedPolyLine;
|
|
|
|
}
|
|
|
|
|
2018-04-13 07:35:14 -05:00
|
|
|
const std::vector<cvf::Vec3d>& RigWellPath::wellPathPoints() const
|
|
|
|
{
|
|
|
|
return m_wellPathPoints;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<double>& RigWellPath::measureDepths() const
|
|
|
|
{
|
|
|
|
return m_measuredDepths;
|
|
|
|
}
|
|
|
|
|