mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fishbones : Add model and visualization
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -52,3 +54,106 @@ double RigWellPath::datumElevation() const
|
||||
return m_datumElevation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth)
|
||||
{
|
||||
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
|
||||
|
||||
size_t i = 0;
|
||||
while (i < m_measuredDepths.size() && m_measuredDepths.at(i) < measuredDepth )
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
if (m_measuredDepths.size() > i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
//For measuredDepth same or lower than first point, use this first point
|
||||
wellPathPoint = m_wellPathPoints.at(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Do interpolation
|
||||
double stepsize = (measuredDepth - m_measuredDepths.at(i-1)) /
|
||||
(m_measuredDepths.at(i) - m_measuredDepths.at(i - 1));
|
||||
wellPathPoint = m_wellPathPoints.at(i - 1) + stepsize * (m_wellPathPoints.at(i) - m_wellPathPoints.at(i-1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Use endpoint if measuredDepth same or higher than last point
|
||||
wellPathPoint = m_wellPathPoints.at(i-1);
|
||||
}
|
||||
|
||||
|
||||
return wellPathPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
|
||||
{
|
||||
double azimuthAngle = 0.0;
|
||||
|
||||
cvf::Vec3d p1 = cvf::Vec3d::UNDEFINED;
|
||||
cvf::Vec3d p2 = cvf::Vec3d::UNDEFINED;
|
||||
|
||||
twoClosestPoints(position, &p1, &p2);
|
||||
if (!p1.isUndefined() && !p2.isUndefined())
|
||||
{
|
||||
cvf::Vec3d direction = p1 - p2;
|
||||
|
||||
if (abs(direction.x()) > 1e-5)
|
||||
{
|
||||
double atanValue = direction.y() / direction.x();
|
||||
azimuthAngle = atan(atanValue);
|
||||
azimuthAngle = cvf::Math::toDegrees(azimuthAngle);
|
||||
azimuthAngle = -azimuthAngle;
|
||||
}
|
||||
}
|
||||
|
||||
return azimuthAngle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
for (size_t i = 1; i < m_wellPathPoints.size(); i++)
|
||||
{
|
||||
cvf::Vec3d p1 = m_wellPathPoints[i - 1];
|
||||
cvf::Vec3d p2 = m_wellPathPoints[i - 0];
|
||||
|
||||
double candidateDistance = cvf::GeometryTools::linePointSquareDist(p1, p2, position);
|
||||
if (candidateDistance < closestDistance)
|
||||
{
|
||||
closestDistance = candidateDistance;
|
||||
closestIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (closestIndex != cvf::UNDEFINED_DOUBLE)
|
||||
{
|
||||
if (closestIndex > 0)
|
||||
{
|
||||
*p1 = m_wellPathPoints[closestIndex - 1];
|
||||
*p2 = m_wellPathPoints[closestIndex - 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
*p1 = m_wellPathPoints[closestIndex + 1];
|
||||
*p2 = m_wellPathPoints[closestIndex + 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user