Skip to content

Commit

Permalink
Changes based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 13, 2023
1 parent f18eb29 commit f4c61c9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down
28 changes: 11 additions & 17 deletions ApplicationLibCode/ReservoirDataModel/RigWellPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ApplicationLibCode/ReservoirDataModel/RigWellPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class RigWellPath : public cvf::Object, public caf::SignalEmitter
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;
Expand Down

0 comments on commit f4c61c9

Please sign in to comment.