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

@@ -86,17 +86,17 @@ bool Riv3dWellLogDrawSurfaceGenerator::createDrawSurface( const caf::DisplayCoor
size_t indexToFirstVisibleSegment = 0u;
if ( wellPathCollection->wellPathClip )
{
double clipZDistance = wellPathCollection->wellPathClipZDistance;
cvf::Vec3d clipLocation = wellPathClipBoundingBox.max() + clipZDistance * cvf::Vec3d( 0, 0, 1 );
clipLocation = displayCoordTransform->transformToDisplayCoord( clipLocation );
double horizontalLengthAlongWellToClipPoint = 0.0;
double measuredDepthAtFirstClipPoint = 0.0;
double clipZDistance = wellPathCollection->wellPathClipZDistance;
cvf::Vec3d clipLocation = wellPathClipBoundingBox.max() + clipZDistance * cvf::Vec3d::Z_AXIS;
auto clipLocationDisplay = displayCoordTransform->transformToDisplayCoord( clipLocation );
double horizontalLengthAlongWellToClipPoint = 0.0;
double measuredDepthAtFirstClipPoint = 0.0;
wellPathDisplayCoords = RigWellPath::clipPolylineStartAboveZ( wellPathDisplayCoords,
clipLocation.z(),
&horizontalLengthAlongWellToClipPoint,
&measuredDepthAtFirstClipPoint,
&indexToFirstVisibleSegment );
clipLocationDisplay.z(),
horizontalLengthAlongWellToClipPoint,
measuredDepthAtFirstClipPoint,
indexToFirstVisibleSegment );
}
// Create curve normal vectors using the unclipped well path points and normals.

View File

@@ -628,9 +628,9 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
double maxZClipHeight = wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance;
clippedWellPathCenterLine = RigWellPath::clipPolylineStartAboveZ( wellpathCenterLine,
maxZClipHeight,
&horizontalLengthAlongWellToClipPoint,
&measuredDepthAtFirstClipPoint,
&idxToFirstVisibleSegment );
horizontalLengthAlongWellToClipPoint,
measuredDepthAtFirstClipPoint,
idxToFirstVisibleSegment );
}
else
{
@@ -703,7 +703,8 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
const double distanceBetweenLabels = m_rimWellPath->measuredDepthLabelInterval().value();
// Create a round number as start for measured depth label
const double startMeasuredDepth = ( int( measuredDepthAtFirstClipPoint / distanceBetweenLabels ) + 1 ) * distanceBetweenLabels;
const double startMeasuredDepth =
( static_cast<int>( measuredDepthAtFirstClipPoint / distanceBetweenLabels ) + 1 ) * distanceBetweenLabels;
std::vector<std::string> labelTexts;
std::vector<cvf::Vec3d> labelDisplayCoords;

View File

@@ -223,11 +223,8 @@ void RivSeismicSectionPartMgr::appendSurfaceIntersectionLines( cvf::ModelBasicLi
{
const auto& texturePart = texSection->part( i );
std::vector<cvf::Vec3d> polyLineForSection;
// Each part of the seismic section is a rectangle, use two corners of the rectangle to create a polyline
polyLineForSection.push_back( texturePart.rect[0] );
polyLineForSection.push_back( texturePart.rect[1] );
std::vector<cvf::Vec3d> polyLineForSection = { texturePart.rect[0], texturePart.rect[1] };
bool closePolyLine = false;
auto polyLineDisplayCoords = projectPolyLineOntoSurface( polyLineForSection, surface, displayCoordTransform );

View File

@@ -764,9 +764,9 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
double dummyDouble;
lines[0] = RigWellPath::clipPolylineStartAboveZ( lines[0],
ownerCase->activeCellsBoundingBox().max().z(),
&horizontalProjectedLengthAlongWellPathToClipPoint,
&dummyDouble,
&dummy );
horizontalProjectedLengthAlongWellPathToClipPoint,
dummyDouble,
dummy );
}
}
}

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;