#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:
Magne Sjaastad authored and GitHub committed 2021-08-26 08:13:03 +02:00
1 parent 61ea190920
commit 2fc65a3b62
32 files changed
+826 -358

No files matched your search

@@ -15,21 +15,22 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigSurface.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSurface::RigSurface()
{
}
#include "cafAssert.h"
#include "cvfBoundingBox.h"
#include "cvfBoundingBoxTree.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSurface::~RigSurface()
{
}
RigSurface::RigSurface() = default;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSurface::~RigSurface() = default;
//--------------------------------------------------------------------------------------------------
///
@@ -92,3 +93,50 @@ std::vector<QString> RigSurface::propertyNames() const
return names;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigSurface::findIntersectingTriangles( const cvf::BoundingBox& inputBB, std::vector<size_t>* triangleStartIndices ) const
{
CAF_ASSERT( m_surfaceBoundingBoxTree.notNull() );
m_surfaceBoundingBoxTree->findIntersections( inputBB, triangleStartIndices );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigSurface::ensureIntersectionSearchTreeIsBuilt()
{
if ( m_surfaceBoundingBoxTree.isNull() )
{
size_t itemCount = triangleCount();
std::vector<cvf::BoundingBox> cellBoundingBoxes;
std::vector<size_t> boundingBoxIds;
cellBoundingBoxes.resize( itemCount );
boundingBoxIds.resize( itemCount );
for ( size_t triangleIdx = 0; triangleIdx < itemCount; ++triangleIdx )
{
cvf::BoundingBox& cellBB = cellBoundingBoxes[triangleIdx];
cellBB.add( m_vertices[m_triangleIndices[triangleIdx * 3 + 0]] );
cellBB.add( m_vertices[m_triangleIndices[triangleIdx * 3 + 1]] );
cellBB.add( m_vertices[m_triangleIndices[triangleIdx * 3 + 2]] );
boundingBoxIds[triangleIdx] = triangleIdx * 3;
}
m_surfaceBoundingBoxTree = new cvf::BoundingBoxTree;
m_surfaceBoundingBoxTree->buildTreeFromBoundingBoxes( cellBoundingBoxes, &boundingBoxIds );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigSurface::triangleCount() const
{
return m_triangleIndices.size() / 3;
}