mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7892 Basic support for display of surface lines and bands on intersections
Guard divide by zero issues 2D Intersection View: Do not add parts with wrong coordinates Add bounding box search tree Add support display of intersection lines for selected surfaces Show band between two first intersection lines
This commit is contained in:
@@ -8,7 +8,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivHexGridIntersectionTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionGeometryGenerator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattner.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattener.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -20,7 +20,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivHexGridIntersectionTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionGeometryGenerator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattner.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattener.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -21,15 +21,20 @@
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigSurface.h"
|
||||
#include "RigSurfaceResampler.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimSurface.h"
|
||||
|
||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
@@ -42,8 +47,6 @@
|
||||
#include "cvfRay.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
|
||||
#include "RivSectionFlattner.h"
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform( const RimExtrudedCurveIntersection* intersection )
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
@@ -66,7 +69,7 @@ RivExtrudedCurveIntersectionGeometryGenerator::RivExtrudedCurveIntersectionGeome
|
||||
bool isFlattened,
|
||||
const cvf::Vec3d& flattenedPolylineStartPoint )
|
||||
: m_intersection( crossSection )
|
||||
, m_polyLines( polylines )
|
||||
, m_polylines( polylines )
|
||||
, m_extrusionDirection( extrusionDirection )
|
||||
, m_hexGrid( grid )
|
||||
, m_isFlattened( isFlattened )
|
||||
@@ -89,28 +92,27 @@ RivExtrudedCurveIntersectionGeometryGenerator::~RivExtrudedCurveIntersectionGeom
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivExtrudedCurveIntersectionGeometryGenerator::calculateSegementTransformPrLinePoint()
|
||||
void RivExtrudedCurveIntersectionGeometryGenerator::calculateLineSegementTransforms()
|
||||
{
|
||||
if ( m_isFlattened )
|
||||
{
|
||||
if ( !( m_polyLines.size() && m_polyLines.back().size() ) ) return;
|
||||
if ( m_polylines.empty() || m_polylines.back().empty() ) return;
|
||||
|
||||
cvf::Vec3d startOffset = m_flattenedPolylineStartPoint;
|
||||
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx )
|
||||
for ( const std::vector<cvf::Vec3d>& polyLine : m_polylines )
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_polyLines[pLineIdx];
|
||||
startOffset.z() = polyLine[0].z();
|
||||
m_segementTransformPrLinePoint.emplace_back(
|
||||
RivSectionFlattner::calculateFlatteningCSsForPolyline( polyLine,
|
||||
m_extrusionDirection,
|
||||
startOffset,
|
||||
&startOffset ) );
|
||||
startOffset.z() = polyLine[0].z();
|
||||
m_lineSegmentTransforms.emplace_back(
|
||||
RivSectionFlattener::calculateFlatteningCSsForPolyline( polyLine,
|
||||
m_extrusionDirection,
|
||||
startOffset,
|
||||
&startOffset ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_segementTransformPrLinePoint.clear();
|
||||
m_lineSegmentTransforms.clear();
|
||||
|
||||
cvf::Vec3d displayOffset( 0, 0, 0 );
|
||||
{
|
||||
@@ -124,10 +126,10 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateSegementTransformPr
|
||||
|
||||
cvf::Mat4d invSectionCS = cvf::Mat4d::fromTranslation( -displayOffset );
|
||||
|
||||
for ( const auto& polyLine : m_polyLines )
|
||||
for ( const auto& polyLine : m_polylines )
|
||||
{
|
||||
m_segementTransformPrLinePoint.emplace_back();
|
||||
std::vector<cvf::Mat4d>& segmentTransforms = m_segementTransformPrLinePoint.back();
|
||||
m_lineSegmentTransforms.emplace_back();
|
||||
std::vector<cvf::Mat4d>& segmentTransforms = m_lineSegmentTransforms.back();
|
||||
for ( size_t lIdx = 0; lIdx < polyLine.size(); ++lIdx )
|
||||
{
|
||||
segmentTransforms.push_back( invSectionCS );
|
||||
@@ -139,21 +141,60 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateSegementTransformPr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivExtrudedCurveIntersectionGeometryGenerator::calculateFlattenedOrOffsetedPolyline()
|
||||
void RivExtrudedCurveIntersectionGeometryGenerator::calculateTransformedPolyline()
|
||||
{
|
||||
CVF_ASSERT( m_segementTransformPrLinePoint.size() == m_polyLines.size() );
|
||||
CVF_ASSERT( m_lineSegmentTransforms.size() == m_polylines.size() );
|
||||
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx )
|
||||
for ( size_t lineIdx = 0; lineIdx < m_polylines.size(); ++lineIdx )
|
||||
{
|
||||
m_flattenedOrOffsettedPolyLines.emplace_back();
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_polyLines[pLineIdx];
|
||||
auto flatPolyline = m_transformedPolyLines.emplace_back();
|
||||
const auto& polyline = m_polylines[lineIdx];
|
||||
|
||||
CVF_ASSERT( polyLine.size() == m_polyLines[pLineIdx].size() );
|
||||
|
||||
for ( size_t pIdx = 0; pIdx < polyLine.size(); ++pIdx )
|
||||
for ( size_t index = 0; index < polyline.size(); ++index )
|
||||
{
|
||||
m_flattenedOrOffsettedPolyLines.back().push_back(
|
||||
polyLine[pIdx].getTransformedPoint( m_segementTransformPrLinePoint[pLineIdx][pIdx] ) );
|
||||
flatPolyline.push_back( transformPointByPolylineSegmentIndex( polyline[index], lineIdx, index ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivExtrudedCurveIntersectionGeometryGenerator::calculateSurfaceIntersectionPoints()
|
||||
{
|
||||
m_transformedSurfaceIntersectionPolylines.clear();
|
||||
|
||||
if ( !m_polylines.empty() )
|
||||
{
|
||||
auto firstPolyLine = m_polylines.front();
|
||||
for ( auto rimSurface : m_intersection->annotatedSurfaces() )
|
||||
{
|
||||
if ( !rimSurface ) return;
|
||||
|
||||
rimSurface->loadDataIfRequired();
|
||||
auto surface = rimSurface->surfaceData();
|
||||
|
||||
std::vector<cvf::Vec3d> transformedSurfacePolyline;
|
||||
|
||||
// Resample polyline to required resolution
|
||||
const double maxLineSegmentLength = 1.0;
|
||||
auto resampledPolyline = computeResampledPolyline( firstPolyLine, maxLineSegmentLength );
|
||||
|
||||
for ( auto [point, segmentIndex] : resampledPolyline )
|
||||
{
|
||||
cvf::Vec3d pointAbove = cvf::Vec3d( point.x(), point.y(), 10000.0 );
|
||||
cvf::Vec3d pointBelow = cvf::Vec3d( point.x(), point.y(), -10000.0 );
|
||||
|
||||
cvf::Vec3d intersectionPoint;
|
||||
bool foundMatch = RigSurfaceResampler::resamplePoint( surface, pointAbove, pointBelow, intersectionPoint );
|
||||
if ( !foundMatch )
|
||||
intersectionPoint = cvf::Vec3d( point.x(), point.y(), std::numeric_limits<double>::infinity() );
|
||||
|
||||
const size_t lineIndex = 0;
|
||||
transformedSurfacePolyline.push_back(
|
||||
transformPointByPolylineSegmentIndex( intersectionPoint, lineIndex, segmentIndex ) );
|
||||
}
|
||||
m_transformedSurfaceIntersectionPolylines[rimSurface] = transformedSurfacePolyline;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,12 +269,12 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
|
||||
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
|
||||
|
||||
calculateSegementTransformPrLinePoint();
|
||||
calculateFlattenedOrOffsetedPolyline();
|
||||
calculateLineSegementTransforms();
|
||||
calculateTransformedPolyline();
|
||||
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx )
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_polylines.size(); ++pLineIdx )
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_polyLines[pLineIdx];
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_polylines[pLineIdx];
|
||||
|
||||
if ( polyLine.size() < 2 ) continue;
|
||||
|
||||
@@ -241,7 +282,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
size_t lIdx = 0;
|
||||
while ( lIdx < lineCount - 1 )
|
||||
{
|
||||
size_t idxToNextP = RivSectionFlattner::indexToNextValidPoint( polyLine, m_extrusionDirection, lIdx );
|
||||
size_t idxToNextP = RivSectionFlattener::indexToNextValidPoint( polyLine, m_extrusionDirection, lIdx );
|
||||
|
||||
if ( idxToNextP == size_t( -1 ) ) break;
|
||||
|
||||
@@ -257,7 +298,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
double maxSectionHeightUp = 0;
|
||||
double maxSectionHeightDown = 0;
|
||||
|
||||
if ( m_intersection->type == RimExtrudedCurveIntersection::CS_AZIMUTHLINE )
|
||||
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE )
|
||||
{
|
||||
maxSectionHeightUp = m_intersection->lengthUp();
|
||||
maxSectionHeightDown = m_intersection->lengthDown();
|
||||
@@ -305,12 +346,10 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
cvf::Vec3d cellCorners[8];
|
||||
size_t cornerIndices[8];
|
||||
|
||||
cvf::Mat4d invSectionCS = m_segementTransformPrLinePoint[pLineIdx][lIdx];
|
||||
cvf::Mat4d invSectionCS = m_lineSegmentTransforms[pLineIdx][lIdx];
|
||||
|
||||
for ( size_t cccIdx = 0; cccIdx < columnCellCandidates.size(); ++cccIdx )
|
||||
for ( auto globalCellIdx : columnCellCandidates )
|
||||
{
|
||||
size_t globalCellIdx = columnCellCandidates[cccIdx];
|
||||
|
||||
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
|
||||
|
||||
hexPlaneCutTriangleVxes.clear();
|
||||
@@ -323,10 +362,10 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
&hexPlaneCutTriangleVxes,
|
||||
&cellFaceForEachTriangleEdge );
|
||||
|
||||
if ( m_intersection->type == RimExtrudedCurveIntersection::CS_AZIMUTHLINE )
|
||||
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE )
|
||||
{
|
||||
bool hasAnyPointsOnSurface = false;
|
||||
for ( caf::HexGridIntersectionTools::ClipVx vertex : hexPlaneCutTriangleVxes )
|
||||
for ( const caf::HexGridIntersectionTools::ClipVx& vertex : hexPlaneCutTriangleVxes )
|
||||
{
|
||||
cvf::Vec3d temp = vertex.vx - p1;
|
||||
double dot = temp.dot( m_extrusionDirection );
|
||||
@@ -400,22 +439,22 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
caf::HexGridIntersectionTools::ClipVx cvx = clippedTriangleVxes[triVxIdx + i];
|
||||
if ( cvx.isVxIdsNative )
|
||||
{
|
||||
m_triVxToCellCornerWeights.push_back( RivIntersectionVertexWeights( cvx.clippedEdgeVx1Id,
|
||||
cvx.clippedEdgeVx2Id,
|
||||
cvx.normDistFromEdgeVx1 ) );
|
||||
m_triVxToCellCornerWeights.emplace_back( cvx.clippedEdgeVx1Id,
|
||||
cvx.clippedEdgeVx2Id,
|
||||
cvx.normDistFromEdgeVx1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id];
|
||||
caf::HexGridIntersectionTools::ClipVx cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id];
|
||||
|
||||
m_triVxToCellCornerWeights.push_back( RivIntersectionVertexWeights( cvx1.clippedEdgeVx1Id,
|
||||
cvx1.clippedEdgeVx2Id,
|
||||
cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id,
|
||||
cvx2.clippedEdgeVx2Id,
|
||||
cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1 ) );
|
||||
m_triVxToCellCornerWeights.emplace_back( cvx1.clippedEdgeVx1Id,
|
||||
cvx1.clippedEdgeVx2Id,
|
||||
cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id,
|
||||
cvx2.clippedEdgeVx2Id,
|
||||
cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,8 +469,10 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
|
||||
|
||||
for ( const auto& it : meshAcc.faultToHighestFaultMeshVxMap )
|
||||
{
|
||||
m_faultMeshLabelAndAnchorPositions.push_back( { it.first->name(), it.second } );
|
||||
m_faultMeshLabelAndAnchorPositions.emplace_back( it.first->name(), it.second );
|
||||
}
|
||||
|
||||
calculateSurfaceIntersectionPoints();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -491,7 +532,7 @@ cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::create
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::createLineAlongPolylineDrawable()
|
||||
{
|
||||
return RivPolylineGenerator::createLineAlongPolylineDrawable( m_flattenedOrOffsettedPolyLines );
|
||||
return RivPolylineGenerator::createLineAlongPolylineDrawable( m_transformedPolyLines );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -517,7 +558,7 @@ cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::create
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::createPointsFromPolylineDrawable()
|
||||
{
|
||||
return RivPolylineGenerator::createPointsFromPolylineDrawable( m_flattenedOrOffsettedPolyLines );
|
||||
return RivPolylineGenerator::createPointsFromPolylineDrawable( m_transformedPolyLines );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -538,6 +579,23 @@ cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::create
|
||||
std::vector<std::vector<cvf::Vec3d>>( { displayCoords } ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<std::vector<cvf::Vec3d>>& RivExtrudedCurveIntersectionGeometryGenerator::flattenedOrOffsettedPolyLines()
|
||||
{
|
||||
return m_transformedPolyLines;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<std::pair<QString, cvf::Vec3d>>&
|
||||
RivExtrudedCurveIntersectionGeometryGenerator::faultMeshLabelAndAnchorPositions()
|
||||
{
|
||||
return m_faultMeshLabelAndAnchorPositions;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -574,6 +632,75 @@ RimExtrudedCurveIntersection* RivExtrudedCurveIntersectionGeometryGenerator::int
|
||||
return m_intersection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivExtrudedCurveIntersectionGeometryGenerator::transformPointByPolylineSegmentIndex( const cvf::Vec3d& domainCoord,
|
||||
size_t lineIndex,
|
||||
size_t segmentIndex )
|
||||
{
|
||||
CVF_ASSERT( lineIndex < m_lineSegmentTransforms.size() );
|
||||
CVF_ASSERT( segmentIndex < m_lineSegmentTransforms[lineIndex].size() );
|
||||
|
||||
// Each line segment along the polyline has a transformation matrix representing the transformation from 3D into
|
||||
// flat 2D. Return the transformed domain coord using the required transformation matrix
|
||||
|
||||
return domainCoord.getTransformedPoint( m_lineSegmentTransforms[lineIndex][segmentIndex] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<cvf::Vec3d, size_t>>
|
||||
RivExtrudedCurveIntersectionGeometryGenerator::computeResampledPolyline( const std::vector<cvf::Vec3d>& polyline,
|
||||
double resamplingDistance )
|
||||
{
|
||||
// Segments along the original polyline must be provided to be able to find the associated transform matrix
|
||||
std::vector<std::pair<cvf::Vec3d, size_t>> resampledPolyline;
|
||||
|
||||
if ( polyline.size() > 1 )
|
||||
{
|
||||
std::vector<double> measuredDepth;
|
||||
{
|
||||
double aggregatedLength = 0.0;
|
||||
|
||||
cvf::Vec3d previousPoint = polyline.front();
|
||||
measuredDepth.push_back( aggregatedLength );
|
||||
|
||||
for ( size_t i = 1; i < polyline.size(); i++ )
|
||||
{
|
||||
aggregatedLength += ( previousPoint - polyline[i] ).length();
|
||||
previousPoint = polyline[i];
|
||||
measuredDepth.push_back( aggregatedLength );
|
||||
}
|
||||
}
|
||||
|
||||
// Use RigWellPath to perform the interpolation along a line based on measured depth
|
||||
RigWellPath dummyWellPath( polyline, measuredDepth );
|
||||
|
||||
for ( size_t i = 1; i < polyline.size(); i++ )
|
||||
{
|
||||
const auto& lineSegmentStart = polyline[i - 1];
|
||||
const auto& lineSegmentEnd = polyline[i];
|
||||
|
||||
auto startMD = measuredDepth[i - 1];
|
||||
auto endMD = measuredDepth[i];
|
||||
|
||||
const size_t segmentIndex = i - 1;
|
||||
resampledPolyline.emplace_back( lineSegmentStart, segmentIndex );
|
||||
|
||||
for ( auto md = startMD + resamplingDistance; md < endMD; md += resamplingDistance )
|
||||
{
|
||||
resampledPolyline.emplace_back( dummyWellPath.interpolatedPointAlongWellPath( md ), segmentIndex );
|
||||
}
|
||||
|
||||
resampledPolyline.emplace_back( lineSegmentEnd, segmentIndex );
|
||||
}
|
||||
}
|
||||
|
||||
return resampledPolyline;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -582,20 +709,20 @@ cvf::Mat4d
|
||||
{
|
||||
cvf::Mat4d flattenMx = cvf::Mat4d::IDENTITY;
|
||||
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_flattenedOrOffsettedPolyLines.size(); pLineIdx++ )
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_transformedPolyLines.size(); pLineIdx++ )
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_flattenedOrOffsettedPolyLines[pLineIdx];
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_transformedPolyLines[pLineIdx];
|
||||
for ( size_t pIdx = 0; pIdx < polyLine.size(); pIdx++ )
|
||||
{
|
||||
if ( polyLine[pIdx].x() >= intersectionPointFlat.x() )
|
||||
{
|
||||
size_t csIdx = pIdx > 0 ? pIdx - 1 : 0;
|
||||
flattenMx = m_segementTransformPrLinePoint[pLineIdx][csIdx];
|
||||
flattenMx = m_lineSegmentTransforms[pLineIdx][csIdx];
|
||||
break;
|
||||
}
|
||||
else if ( pIdx == polyLine.size() - 1 )
|
||||
if ( pIdx == polyLine.size() - 1 )
|
||||
{
|
||||
flattenMx = m_segementTransformPrLinePoint[pLineIdx][pIdx];
|
||||
flattenMx = m_lineSegmentTransforms[pLineIdx][pIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -612,8 +739,15 @@ bool RivExtrudedCurveIntersectionGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<RimSurface*, std::vector<cvf::Vec3d>>
|
||||
RivExtrudedCurveIntersectionGeometryGenerator::transformedSurfaceIntersectionPolylines() const
|
||||
{
|
||||
return m_transformedSurfaceIntersectionPolylines;
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ class RigResultAccessor;
|
||||
class RimExtrudedCurveIntersection;
|
||||
class RivIntersectionHexGridInterface;
|
||||
class RivIntersectionVertexWeights;
|
||||
class RimSurface;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -68,34 +69,37 @@ public:
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromExtrusionLineDrawable( const std::vector<cvf::Vec3d>& extrusionLine );
|
||||
|
||||
const std::vector<std::vector<cvf::Vec3d>>& flattenedOrOffsettedPolyLines()
|
||||
{
|
||||
return m_flattenedOrOffsettedPolyLines;
|
||||
}
|
||||
const std::vector<std::pair<QString, cvf::Vec3d>>& faultMeshLabelAndAnchorPositions()
|
||||
{
|
||||
return m_faultMeshLabelAndAnchorPositions;
|
||||
}
|
||||
|
||||
RimExtrudedCurveIntersection* intersection() const;
|
||||
const std::vector<std::pair<QString, cvf::Vec3d>>& faultMeshLabelAndAnchorPositions();
|
||||
|
||||
cvf::Mat4d unflattenTransformMatrix( const cvf::Vec3d& intersectionPointFlat ) const;
|
||||
|
||||
// GeomGen Interface
|
||||
bool isAnyGeometryPresent() const override;
|
||||
|
||||
std::map<RimSurface*, std::vector<cvf::Vec3d>> transformedSurfaceIntersectionPolylines() const;
|
||||
|
||||
const std::vector<size_t>& triangleToCellIndex() const override;
|
||||
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const override;
|
||||
const cvf::Vec3fArray* triangleVxes() const override;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
void calculateSegementTransformPrLinePoint();
|
||||
void calculateFlattenedOrOffsetedPolyline();
|
||||
void calculateLineSegementTransforms();
|
||||
void calculateTransformedPolyline();
|
||||
void calculateSurfaceIntersectionPoints();
|
||||
|
||||
RimExtrudedCurveIntersection* intersection() const;
|
||||
|
||||
const std::vector<std::vector<cvf::Vec3d>>& flattenedOrOffsettedPolyLines();
|
||||
cvf::Vec3d transformPointByPolylineSegmentIndex( const cvf::Vec3d& domainCoord, size_t lineIndex, size_t segmentIndex );
|
||||
|
||||
static std::vector<std::pair<cvf::Vec3d, size_t>> computeResampledPolyline( const std::vector<cvf::Vec3d>& polyline,
|
||||
double resamplingDistance );
|
||||
|
||||
private:
|
||||
RimExtrudedCurveIntersection* m_intersection;
|
||||
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
|
||||
const std::vector<std::vector<cvf::Vec3d>> m_polyLines;
|
||||
const std::vector<std::vector<cvf::Vec3d>> m_polylines;
|
||||
cvf::Vec3d m_extrusionDirection;
|
||||
bool m_isFlattened;
|
||||
cvf::Vec3d m_flattenedPolylineStartPoint;
|
||||
@@ -106,8 +110,10 @@ private:
|
||||
cvf::ref<cvf::Vec3fArray> m_faultCellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivIntersectionVertexWeights> m_triVxToCellCornerWeights;
|
||||
std::vector<std::vector<cvf::Vec3d>> m_flattenedOrOffsettedPolyLines;
|
||||
std::vector<std::vector<cvf::Mat4d>> m_segementTransformPrLinePoint;
|
||||
std::vector<std::vector<cvf::Vec3d>> m_transformedPolyLines;
|
||||
std::vector<std::vector<cvf::Mat4d>> m_lineSegmentTransforms;
|
||||
|
||||
std::vector<std::pair<QString, cvf::Vec3d>> m_faultMeshLabelAndAnchorPositions;
|
||||
|
||||
std::map<RimSurface*, std::vector<cvf::Vec3d>> m_transformedSurfaceIntersectionPolylines;
|
||||
};
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@@ -55,6 +56,7 @@
|
||||
#include "RivObjectSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
@@ -66,6 +68,7 @@
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfGeometryBuilderDrawableGeo.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
@@ -94,7 +97,7 @@ RivExtrudedCurveIntersectionPartMgr::RivExtrudedCurveIntersectionPartMgr( RimExt
|
||||
cvf::Vec3d flattenedPolylineStartPoint;
|
||||
|
||||
std::vector<std::vector<cvf::Vec3d>> polyLines = m_rimIntersection->polyLines( &flattenedPolylineStartPoint );
|
||||
if ( polyLines.size() > 0 )
|
||||
if ( !polyLines.empty() )
|
||||
{
|
||||
cvf::Vec3d direction = m_rimIntersection->extrusionDirection();
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = m_rimIntersection->createHexGridInterface();
|
||||
@@ -175,7 +178,7 @@ void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMech
|
||||
{
|
||||
textureCoords->resize( vertexWeights.size() );
|
||||
|
||||
if ( resultValues.size() == 0 )
|
||||
if ( resultValues.empty() )
|
||||
{
|
||||
textureCoords->setAll( cvf::Vec2f( 0.0, 1.0f ) );
|
||||
}
|
||||
@@ -249,7 +252,7 @@ void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivExtrudedCurveIntersectionSourceInfo> si =
|
||||
new RivExtrudedCurveIntersectionSourceInfo( m_intersectionGenerator.p() );
|
||||
new RivExtrudedCurveIntersectionSourceInfo( m_intersectionGenerator.p(), m_rimIntersection );
|
||||
part->setSourceInfo( si.p() );
|
||||
|
||||
part->updateBoundingBox();
|
||||
@@ -314,6 +317,8 @@ void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
|
||||
if ( m_isFlattened ) createFaultLabelParts( m_intersectionGenerator->faultMeshLabelAndAnchorPositions() );
|
||||
|
||||
applySingleColorEffect();
|
||||
|
||||
createAnnotationSurfaceParts( useBufferObjects );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -324,7 +329,7 @@ void RivExtrudedCurveIntersectionPartMgr::createFaultLabelParts( const std::vect
|
||||
m_faultMeshLabels = nullptr;
|
||||
m_faultMeshLabelLines = nullptr;
|
||||
|
||||
if ( !labelAndAnchors.size() ) return;
|
||||
if ( labelAndAnchors.empty() ) return;
|
||||
|
||||
RimFaultInViewCollection* faultInViewColl = nullptr;
|
||||
|
||||
@@ -375,7 +380,7 @@ void RivExtrudedCurveIntersectionPartMgr::createFaultLabelParts( const std::vect
|
||||
textCoord.z() += labelZOffset;
|
||||
drawableText->addText( cvfString, textCoord );
|
||||
|
||||
lineVertices.push_back( cvf::Vec3f( labelAndAnchorPair.second ) );
|
||||
lineVertices.emplace_back( labelAndAnchorPair.second );
|
||||
lineVertices.push_back( textCoord );
|
||||
visibleFaultNameCount++;
|
||||
}
|
||||
@@ -433,8 +438,8 @@ void RivExtrudedCurveIntersectionPartMgr::createPolyLineParts( bool useBufferObj
|
||||
m_highlightLineAlongPolyline = nullptr;
|
||||
m_highlightPointsForPolyline = nullptr;
|
||||
|
||||
if ( m_rimIntersection->type == RimExtrudedCurveIntersection::CS_POLYLINE ||
|
||||
m_rimIntersection->type == RimExtrudedCurveIntersection::CS_AZIMUTHLINE )
|
||||
if ( m_rimIntersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ||
|
||||
m_rimIntersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE )
|
||||
{
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = m_intersectionGenerator->createLineAlongPolylineDrawable();
|
||||
@@ -514,7 +519,7 @@ void RivExtrudedCurveIntersectionPartMgr::createExtrusionDirParts( bool useBuffe
|
||||
m_highlightLineAlongExtrusionDir = nullptr;
|
||||
m_highlightPointsForExtrusionDir = nullptr;
|
||||
|
||||
if ( m_rimIntersection->direction() == RimExtrudedCurveIntersection::CS_TWO_POINTS )
|
||||
if ( m_rimIntersection->direction() == RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_TWO_POINTS )
|
||||
{
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = m_intersectionGenerator->createLineAlongExtrusionLineDrawable(
|
||||
@@ -588,6 +593,99 @@ void RivExtrudedCurveIntersectionPartMgr::createExtrusionDirParts( bool useBuffe
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivExtrudedCurveIntersectionPartMgr::createAnnotationSurfaceParts( bool useBufferObjects )
|
||||
{
|
||||
m_annotationParts.clear();
|
||||
|
||||
auto surfPolys = m_intersectionGenerator->transformedSurfaceIntersectionPolylines();
|
||||
for ( auto [surface, polylines] : surfPolys )
|
||||
{
|
||||
if ( !surface ) continue;
|
||||
|
||||
auto polylineGeo = RivPolylineGenerator::createLineAlongPolylineDrawable( polylines );
|
||||
if ( polylineGeo.notNull() )
|
||||
{
|
||||
if ( useBufferObjects )
|
||||
{
|
||||
polylineGeo->setRenderMode( cvf::DrawableGeo::BUFFER_OBJECT );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( "Intersection " + surface->userDescription().toStdString() );
|
||||
part->setDrawable( polylineGeo.p() );
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setPriority( RivPartPriority::PartType::Highlight );
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator lineEffGen( surface->color() );
|
||||
|
||||
lineEffGen.setLineWidth( 5.0f );
|
||||
|
||||
eff = lineEffGen.generateUnCachedEffect();
|
||||
part->setEffect( eff.p() );
|
||||
|
||||
m_annotationParts.push_back( part.p() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( surfPolys.size() > 1 )
|
||||
{
|
||||
// Create a quad strip between the two first polylines
|
||||
|
||||
auto firstSurfaceItem = surfPolys.begin();
|
||||
auto secondSurfaceItem = firstSurfaceItem++;
|
||||
|
||||
auto polylineA = firstSurfaceItem->second;
|
||||
auto polylineB = secondSurfaceItem->second;
|
||||
|
||||
size_t pointCount = std::min( polylineA.size(), polylineB.size() );
|
||||
if ( pointCount > 1 )
|
||||
{
|
||||
cvf::GeometryBuilderDrawableGeo geoBuilder;
|
||||
|
||||
for ( size_t i = 1; i < pointCount; i++ )
|
||||
{
|
||||
const auto& pA0 = polylineA[i - 1];
|
||||
const auto& pA1 = polylineA[i];
|
||||
const auto& pB0 = polylineB[i - 1];
|
||||
const auto& pB1 = polylineB[i];
|
||||
|
||||
geoBuilder.addQuadByVertices( cvf::Vec3f( pA0 ), cvf::Vec3f( pA1 ), cvf::Vec3f( pB1 ), cvf::Vec3f( pB0 ) );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = geoBuilder.drawableGeo();
|
||||
if ( geo.notNull() )
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
if ( useBufferObjects )
|
||||
{
|
||||
geo->setRenderMode( cvf::DrawableGeo::BUFFER_OBJECT );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( "Surface Intersection Band" );
|
||||
part->setDrawable( geo.p() );
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask( intersectionCellFaceBit );
|
||||
part->setPriority( RivPartPriority::PartType::Transparent );
|
||||
|
||||
auto color = cvf::Color4f( cvf::Color3f::OLIVE, 0.5f );
|
||||
caf::SurfaceEffectGenerator geometryEffgen( color, caf::PO_NEG_LARGE );
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
|
||||
part->setEffect( geometryOnlyEffect.p() );
|
||||
|
||||
m_annotationParts.push_back( part.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -649,9 +747,9 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
|
||||
cvf::ModelBasicList* model,
|
||||
cvf::Transform* scaleTransform )
|
||||
{
|
||||
Rim2dIntersectionView* curr2dView = dynamic_cast<Rim2dIntersectionView*>( &view );
|
||||
auto* curr2dView = dynamic_cast<Rim2dIntersectionView*>( &view );
|
||||
|
||||
if ( m_rimIntersection->inputPolyLineFromViewerEnabled || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
if ( m_rimIntersection->inputPolyLineFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
{
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
{
|
||||
@@ -666,7 +764,7 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_rimIntersection->inputExtrusionPointsFromViewerEnabled )
|
||||
if ( m_rimIntersection->inputExtrusionPointsFromViewerEnabled() )
|
||||
{
|
||||
if ( m_highlightLineAlongExtrusionDir.notNull() )
|
||||
{
|
||||
@@ -681,7 +779,7 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_rimIntersection->inputTwoAzimuthPointsFromViewerEnabled || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
if ( m_rimIntersection->inputTwoAzimuthPointsFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
{
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
{
|
||||
@@ -695,14 +793,16 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
|
||||
model->addPart( m_highlightPointsForPolyline.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimExtrudedCurveIntersection* RivExtrudedCurveIntersectionPartMgr::intersection() const
|
||||
{
|
||||
return m_rimIntersection.p();
|
||||
for ( size_t i = 0; i < m_annotationParts.size(); i++ )
|
||||
{
|
||||
auto part = m_annotationParts[i];
|
||||
if ( part.notNull() )
|
||||
{
|
||||
part->setTransform( scaleTransform );
|
||||
model->addPart( part.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -720,5 +820,5 @@ const RivIntersectionGeometryGeneratorIF* RivExtrudedCurveIntersectionPartMgr::i
|
||||
{
|
||||
if ( m_intersectionGenerator.notNull() ) return m_intersectionGenerator.p();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
@@ -76,18 +77,16 @@ public:
|
||||
void appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
void appendPolylinePartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
|
||||
const RimExtrudedCurveIntersection* intersection() const;
|
||||
|
||||
cvf::Mat4d unflattenTransformMatrix( const cvf::Vec3d& intersectionPointFlat ) const;
|
||||
|
||||
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const;
|
||||
|
||||
public:
|
||||
private:
|
||||
void generatePartGeometry();
|
||||
void createFaultLabelParts( const std::vector<std::pair<QString, cvf::Vec3d>>& labelAndAnchors );
|
||||
void createPolyLineParts( bool useBufferObjects );
|
||||
void createExtrusionDirParts( bool useBufferObjects );
|
||||
void createAnnotationSurfaceParts( bool useBufferObjects );
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimExtrudedCurveIntersection> m_rimIntersection;
|
||||
@@ -104,6 +103,8 @@ private:
|
||||
cvf::ref<cvf::Part> m_highlightLineAlongExtrusionDir;
|
||||
cvf::ref<cvf::Part> m_highlightPointsForExtrusionDir;
|
||||
|
||||
cvf::Collection<cvf::Part> m_annotationParts;
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> m_intersectionFacesTextureCoords;
|
||||
|
||||
struct RivPipeBranchData
|
||||
|
@@ -19,14 +19,17 @@
|
||||
|
||||
#include "RivExtrudedCurveIntersectionSourceInfo.h"
|
||||
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RivExtrudedCurveIntersectionGeometryGenerator.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivExtrudedCurveIntersectionSourceInfo::RivExtrudedCurveIntersectionSourceInfo(
|
||||
RivExtrudedCurveIntersectionGeometryGenerator* geometryGenerator )
|
||||
RivExtrudedCurveIntersectionGeometryGenerator* geometryGenerator,
|
||||
RimExtrudedCurveIntersection* intersection )
|
||||
: m_intersectionGeometryGenerator( geometryGenerator )
|
||||
, m_intersection( intersection )
|
||||
{
|
||||
CVF_ASSERT( m_intersectionGeometryGenerator.notNull() );
|
||||
}
|
||||
@@ -59,5 +62,5 @@ std::array<cvf::Vec3f, 3> RivExtrudedCurveIntersectionSourceInfo::triangle( int
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimExtrudedCurveIntersection* RivExtrudedCurveIntersectionSourceInfo::intersection() const
|
||||
{
|
||||
return m_intersectionGeometryGenerator->intersection();
|
||||
return m_intersection;
|
||||
}
|
||||
|
@@ -19,8 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
class RivExtrudedCurveIntersectionGeometryGenerator;
|
||||
@@ -29,7 +32,8 @@ class RimExtrudedCurveIntersection;
|
||||
class RivExtrudedCurveIntersectionSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
explicit RivExtrudedCurveIntersectionSourceInfo( RivExtrudedCurveIntersectionGeometryGenerator* geometryGenerator );
|
||||
explicit RivExtrudedCurveIntersectionSourceInfo( RivExtrudedCurveIntersectionGeometryGenerator* geometryGenerator,
|
||||
RimExtrudedCurveIntersection* intersection );
|
||||
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
std::array<cvf::Vec3f, 3> triangle( int triangleIdx ) const;
|
||||
@@ -37,4 +41,5 @@ public:
|
||||
|
||||
private:
|
||||
cvf::cref<RivExtrudedCurveIntersectionGeometryGenerator> m_intersectionGeometryGenerator;
|
||||
caf::PdmPointer<RimExtrudedCurveIntersection> m_intersection;
|
||||
};
|
||||
|
@@ -16,7 +16,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -25,9 +25,9 @@
|
||||
///
|
||||
/// Returns size_t(-1) if no point is found
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RivSectionFlattner::indexToNextValidPoint( const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
size_t idxToStartOfLineSegment )
|
||||
size_t RivSectionFlattener::indexToNextValidPoint( const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
size_t idxToStartOfLineSegment )
|
||||
{
|
||||
size_t lineCount = polyLine.size();
|
||||
if ( !( idxToStartOfLineSegment + 1 < lineCount ) ) return -1;
|
||||
@@ -51,10 +51,10 @@ size_t RivSectionFlattner::indexToNextValidPoint( const std::vector<cvf::Vec3d>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns one CS pr point, valid for the next segment
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Mat4d> RivSectionFlattner::calculateFlatteningCSsForPolyline( const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d& extrusionDir,
|
||||
const cvf::Vec3d& startOffset,
|
||||
cvf::Vec3d* endOffset )
|
||||
std::vector<cvf::Mat4d> RivSectionFlattener::calculateFlatteningCSsForPolyline( const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d& extrusionDir,
|
||||
const cvf::Vec3d& startOffset,
|
||||
cvf::Vec3d* endOffset )
|
||||
{
|
||||
CVF_ASSERT( endOffset );
|
||||
size_t pointCount = polyLine.size();
|
||||
@@ -128,9 +128,9 @@ std::vector<cvf::Mat4d> RivSectionFlattner::calculateFlatteningCSsForPolyline( c
|
||||
/// Ey normal to the section plane
|
||||
/// Ex in plane along p1-p2
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Mat4d RivSectionFlattner::calculateSectionLocalFlatteningCS( const cvf::Vec3d& p1,
|
||||
const cvf::Vec3d& p2,
|
||||
const cvf::Vec3d& extrusionDir )
|
||||
cvf::Mat4d RivSectionFlattener::calculateSectionLocalFlatteningCS( const cvf::Vec3d& p1,
|
||||
const cvf::Vec3d& p2,
|
||||
const cvf::Vec3d& extrusionDir )
|
||||
{
|
||||
using namespace cvf;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RivSectionFlattner
|
||||
class RivSectionFlattener
|
||||
{
|
||||
public:
|
||||
static size_t indexToNextValidPoint( const std::vector<cvf::Vec3d>& polyLine,
|
@@ -37,7 +37,7 @@
|
||||
#include "RimVirtualPerforationResults.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
#include "RivSimWellConnectionSourceInfo.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
#include "RivWellConnectionFactorGeometryGenerator.h"
|
||||
@@ -203,10 +203,10 @@ void RivSimWellPipesPartMgr::buildWellPipeParts( const caf::DisplayCoordTransfor
|
||||
if ( doFlatten )
|
||||
{
|
||||
std::vector<cvf::Mat4d> flatningCSs =
|
||||
RivSectionFlattner::calculateFlatteningCSsForPolyline( m_pipeBranchesCLCoords[brIdx],
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
flattenedStartOffset,
|
||||
&flattenedStartOffset );
|
||||
RivSectionFlattener::calculateFlatteningCSsForPolyline( m_pipeBranchesCLCoords[brIdx],
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
flattenedStartOffset,
|
||||
&flattenedStartOffset );
|
||||
for ( size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx )
|
||||
{
|
||||
( *cvfCoords )[cIdx] = ( ( *cvfCoords )[cIdx] ).getTransformedPoint( flatningCSs[cIdx] );
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "RivDiskGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
|
@@ -58,7 +58,7 @@
|
||||
#include "RivObjectSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
#include "RivWellConnectionFactorPartMgr.h"
|
||||
#include "RivWellFracturePartMgr.h"
|
||||
@@ -438,12 +438,12 @@ void RivWellPathPartMgr::appendPerforationsToModel( cvf::ModelBasicList*
|
||||
{
|
||||
cvf::Vec3d dummy;
|
||||
vector<cvf::Mat4d> flatningCSs =
|
||||
RivSectionFlattner::calculateFlatteningCSsForPolyline( perfIntervalCL,
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
{ horizontalLengthAlongWellPath,
|
||||
0.0,
|
||||
perfIntervalCL[0].z() },
|
||||
&dummy );
|
||||
RivSectionFlattener::calculateFlatteningCSsForPolyline( perfIntervalCL,
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
{ horizontalLengthAlongWellPath,
|
||||
0.0,
|
||||
perfIntervalCL[0].z() },
|
||||
&dummy );
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < perfIntervalCL.size(); ++cIdx )
|
||||
{
|
||||
@@ -668,12 +668,12 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
|
||||
{
|
||||
cvf::Vec3d dummy;
|
||||
std::vector<cvf::Mat4d> flatningCSs =
|
||||
RivSectionFlattner::calculateFlatteningCSsForPolyline( clippedWellPathCenterLine,
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
{ horizontalLengthAlongWellToClipPoint,
|
||||
0.0,
|
||||
clippedWellPathCenterLine[0].z() },
|
||||
&dummy );
|
||||
RivSectionFlattener::calculateFlatteningCSsForPolyline( clippedWellPathCenterLine,
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
{ horizontalLengthAlongWellToClipPoint,
|
||||
0.0,
|
||||
clippedWellPathCenterLine[0].z() },
|
||||
&dummy );
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx )
|
||||
{
|
||||
@@ -814,11 +814,8 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
|
||||
cvf::GeometryBuilderTriangles builder;
|
||||
cvf::GeometryUtils::createSphere( cellRadius, 15, 15, &builder );
|
||||
vectorDrawable->setGlyph( builder.trianglesUShort().p(), builder.vertices().p() );
|
||||
|
||||
{
|
||||
vectorDrawable->setRadius( cellRadius );
|
||||
vectorDrawable->setCenterCoords( vertices.p() );
|
||||
}
|
||||
vectorDrawable->setRadius( cellRadius );
|
||||
vectorDrawable->setCenterCoords( vertices.p() );
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( "RivWellPathPartMgr_WellTargetSpheres" );
|
||||
@@ -906,10 +903,16 @@ void RivWellPathPartMgr::appendFlattenedStaticGeometryPartsToModel( cvf::ModelBa
|
||||
model->addPart( m_wellLabelPart.p() );
|
||||
}
|
||||
|
||||
if ( m_spherePart.notNull() )
|
||||
{
|
||||
model->addPart( m_spherePart.p() );
|
||||
}
|
||||
/*
|
||||
// TODO: Currently not supported.
|
||||
// Require coordinate transformations of the spheres similar to RivWellPathPartMgr::buildWellPathParts
|
||||
// https://github.com/OPM/ResInsight/issues/7891
|
||||
//
|
||||
if ( m_spherePart.notNull() )
|
||||
{
|
||||
model->addPart( m_spherePart.p() );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "RivSurfaceIntersectionGeometryGenerator.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
@@ -32,10 +34,13 @@
|
||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivSectionFlattener.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
|
||||
#include "../cafHexInterpolator/cafHexInterpolator.h" // Use relative path, as this is a header only file not part of a library
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfPlane.h"
|
||||
@@ -44,12 +49,6 @@
|
||||
#include "cvfRay.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
|
||||
#include "../cafHexInterpolator/cafHexInterpolator.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "clipper.hpp"
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform( const RimIntersection* intersection )
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
@@ -206,10 +205,8 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
||||
std::array<cvf::Vec3d, 8> cellCorners;
|
||||
std::array<size_t, 8> cornerIndices;
|
||||
|
||||
for ( size_t ticIdx = 0; ticIdx < triIntersectedCellCandidates.size(); ++ticIdx )
|
||||
for ( size_t globalCellIdx : triIntersectedCellCandidates )
|
||||
{
|
||||
size_t globalCellIdx = triIntersectedCellCandidates[ticIdx];
|
||||
|
||||
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
|
||||
|
||||
hexPlaneCutTriangleVxes.clear();
|
||||
@@ -309,7 +306,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
||||
|
||||
for ( const auto& it : meshAcc.faultToHighestFaultMeshVxMap )
|
||||
{
|
||||
m_faultMeshLabelAndAnchorPositions.push_back( { it.first->name(), it.second } );
|
||||
m_faultMeshLabelAndAnchorPositions.emplace_back( it.first->name(), it.second );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,8 +414,6 @@ bool RivSurfaceIntersectionGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -132,6 +132,9 @@ void RivWindowEdgeAxesOverlayItem::updateFromCamera( const Camera* camera )
|
||||
windowMaxInDomain = m_dispalyCoordsTransform->transformToDomainCoord( windowMaxInDomain );
|
||||
}
|
||||
|
||||
// For extreme zoom factors we might end up with both variables as zero. Return to avoid divide by zero.
|
||||
if ( windowOrigoInDomain == windowMaxInDomain ) return;
|
||||
|
||||
double domainMinX = windowOrigoInDomain.x();
|
||||
double domainMaxX = windowMaxInDomain.x();
|
||||
|
||||
|
Reference in New Issue
Block a user