Changes based on review

This commit is contained in:
Magne Sjaastad
2023-09-12 19:59:16 +02:00
parent f18eb29552
commit f4c61c9edb
6 changed files with 33 additions and 41 deletions

View File

@@ -584,18 +584,15 @@ bool RigWellPath::isAnyPointInsideBoundingBox( const std::vector<cvf::Vec3d>& po
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ( const std::vector<cvf::Vec3d>& polyLine,
double maxZ,
double* horizontalLengthAlongWellToClipPoint,
double* measuredDepthAtFirstClipPoint,
size_t* indexToFirstVisibleSegment )
const double maxZ,
double& horizontalLengthAlongWellToClipPoint,
double& measuredDepthAtFirstClipPoint,
size_t& indexToFirstVisibleSegment )
{
CVF_ASSERT( horizontalLengthAlongWellToClipPoint );
CVF_ASSERT( indexToFirstVisibleSegment );
// Find first visible point, and accumulate distance along wellpath
*horizontalLengthAlongWellToClipPoint = 0.0;
*indexToFirstVisibleSegment = cvf::UNDEFINED_SIZE_T;
horizontalLengthAlongWellToClipPoint = 0.0;
indexToFirstVisibleSegment = cvf::UNDEFINED_SIZE_T;
size_t firstVisiblePointIndex = cvf::UNDEFINED_SIZE_T;
@@ -606,13 +603,10 @@ std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ( const std::vector<
if ( vxIdx > 0 )
{
cvf::Vec3d segment = polyLine[vxIdx] - polyLine[vxIdx - 1];
if ( measuredDepthAtFirstClipPoint )
{
*measuredDepthAtFirstClipPoint += segment.length();
}
measuredDepthAtFirstClipPoint += segment.length();
segment[2] = 0.0;
*horizontalLengthAlongWellToClipPoint += segment.length();
horizontalLengthAlongWellToClipPoint += segment.length();
}
}
else
@@ -641,16 +635,16 @@ std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ( const std::vector<
{
cvf::Vec3d segment = intersection - polyLine[firstVisiblePointIndex - 1];
segment[2] = 0.0;
*horizontalLengthAlongWellToClipPoint += segment.length();
horizontalLengthAlongWellToClipPoint += segment.length();
clippedPolyLine.push_back( intersection );
}
*indexToFirstVisibleSegment = firstVisiblePointIndex - 1;
indexToFirstVisibleSegment = firstVisiblePointIndex - 1;
}
else
{
*indexToFirstVisibleSegment = 0;
indexToFirstVisibleSegment = 0;
}
// Add the rest of the polyline

View File

@@ -86,10 +86,10 @@ public:
static bool isAnyPointInsideBoundingBox( const std::vector<cvf::Vec3d>& points, const cvf::BoundingBox& boundingBox );
static std::vector<cvf::Vec3d> clipPolylineStartAboveZ( const std::vector<cvf::Vec3d>& polyLine,
double maxZ,
double* horizontalLengthAlongWellToClipPoint,
double* measuredDepthAtFirstClipPoint,
size_t* indexToFirstVisibleSegment );
const double maxZ,
double& horizontalLengthAlongWellToClipPoint,
double& measuredDepthAtFirstClipPoint,
size_t& indexToFirstVisibleSegment );
private:
std::pair<size_t, size_t> closestIndices( const cvf::Vec3d& position ) const;