mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-09 15:43:07 -06:00
Generalize the interpolation in RigWellPath
* Make it possible to interpolate any vector along the well path, not just the well path points. This way it can be used for normals. * The interpolation line needs to be a weighted sum of vectors from the two closest points rather than the previous point + a segment, which only works for points. * If used for normals, the end result *has to be normalized*
This commit is contained in:
parent
e8b006d068
commit
1bb1b3004e
@ -59,9 +59,12 @@ double RigWellPath::datumElevation() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, double * horizontalLengthAlongWellToStartClipPoint) const
|
||||
cvf::Vec3d RigWellPath::interpolatedVectorAlongWellPath(const std::vector<cvf::Vec3d>& vectors,
|
||||
double measuredDepth,
|
||||
double * horizontalLengthAlongWellToStartClipPoint /*= nullptr*/) const
|
||||
{
|
||||
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
|
||||
CVF_ASSERT(vectors.size() == m_wellPathPoints.size());
|
||||
cvf::Vec3d interpolatedVector = cvf::Vec3d::ZERO;
|
||||
|
||||
if (horizontalLengthAlongWellToStartClipPoint) *horizontalLengthAlongWellToStartClipPoint = 0.0;
|
||||
|
||||
@ -82,17 +85,15 @@ cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, dou
|
||||
if ( vxIdx == 0 )
|
||||
{
|
||||
//For measuredDepth same or lower than first point, use this first point
|
||||
wellPathPoint = m_wellPathPoints.at(0);
|
||||
interpolatedVector = vectors.at(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Do interpolation
|
||||
double segmentFraction = (measuredDepth - m_measuredDepths.at(vxIdx-1)) /
|
||||
(m_measuredDepths.at(vxIdx) - m_measuredDepths.at(vxIdx - 1));
|
||||
cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx-1];
|
||||
|
||||
segment *= segmentFraction;
|
||||
wellPathPoint = m_wellPathPoints[vxIdx - 1] + segment;
|
||||
cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx - 1];
|
||||
interpolatedVector = (1.0 - segmentFraction) * vectors[vxIdx - 1] + segmentFraction * vectors[vxIdx];
|
||||
|
||||
if ( horizontalLengthAlongWellToStartClipPoint )
|
||||
{
|
||||
@ -104,11 +105,16 @@ cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, dou
|
||||
else
|
||||
{
|
||||
// Use endpoint if measuredDepth same or higher than last point
|
||||
wellPathPoint = m_wellPathPoints.at(vxIdx-1);
|
||||
interpolatedVector = vectors.at(vxIdx-1);
|
||||
}
|
||||
|
||||
|
||||
return wellPathPoint;
|
||||
return interpolatedVector;
|
||||
}
|
||||
|
||||
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, double * horizontalLengthAlongWellToStartClipPoint /*= nullptr*/) const
|
||||
{
|
||||
return interpolatedVectorAlongWellPath(m_wellPathPoints, measuredDepth, horizontalLengthAlongWellToStartClipPoint);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -368,3 +374,13 @@ std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ(const std::vector<c
|
||||
return clippedPolyLine;
|
||||
}
|
||||
|
||||
const std::vector<cvf::Vec3d>& RigWellPath::wellPathPoints() const
|
||||
{
|
||||
return m_wellPathPoints;
|
||||
}
|
||||
|
||||
const std::vector<double>& RigWellPath::measureDepths() const
|
||||
{
|
||||
return m_measuredDepths;
|
||||
}
|
||||
|
||||
|
@ -37,16 +37,19 @@ namespace cvf
|
||||
class RigWellPath : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigWellPath();
|
||||
|
||||
std::vector<cvf::Vec3d> m_wellPathPoints;
|
||||
std::vector<double> m_measuredDepths;
|
||||
|
||||
RigWellPath();
|
||||
void setDatumElevation(double value);
|
||||
bool hasDatumElevation() const;
|
||||
double datumElevation() const;
|
||||
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth,
|
||||
cvf::Vec3d interpolatedVectorAlongWellPath(const std::vector<cvf::Vec3d>& vectors,
|
||||
double measuredDepth,
|
||||
double * horizontalLengthAlongWellToStartClipPoint = nullptr) const;
|
||||
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth,
|
||||
double * horizontalLengthAlongWellToStartClipPoint = nullptr) const;
|
||||
|
||||
double wellPathAzimuthAngle(const cvf::Vec3d& position) const;
|
||||
void twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2) const;
|
||||
|
||||
@ -63,6 +66,8 @@ public:
|
||||
double maxZ,
|
||||
double * horizontalLengthAlongWellToClipPoint,
|
||||
size_t * indexToFirstVisibleSegment);
|
||||
const std::vector<cvf::Vec3d>& wellPathPoints() const;
|
||||
const std::vector<double>& measureDepths() const;
|
||||
|
||||
private:
|
||||
bool m_hasDatumElevation;
|
||||
|
Loading…
Reference in New Issue
Block a user