Use the top and bottom layer of active cells to compute the geometry bounding box

This commit is contained in:
Magne Sjaastad committed 2024-01-22 14:52:49 +01:00
1 parent 80fdd1da74
commit 663c3f31b9
1 file changed
+15 -6
@@ -656,15 +656,24 @@ void RigEclipseCaseData::computeActiveCellsGeometryBoundingBox()
} }
else else
{ {
std::array<cvf::Vec3d, 8> hexCorners; // Use the top and bottom layer of active cells to compute the bounding box
for ( size_t i = 0; i < m_mainGrid->cellCount(); i++ )
auto [minBB, maxBB] = activeInfos[acIdx]->ijkBoundingBox();
for ( auto k : { minBB.z(), maxBB.z() } )
{ {
if ( activeInfos[acIdx]->isActive( i ) ) for ( size_t i = minBB.x(); i <= maxBB.x(); i++ )
{ {
m_mainGrid->cellCornerVertices( i, hexCorners.data() ); for ( size_t j = minBB.y(); j <= maxBB.y(); j++ )
for ( const auto& corner : hexCorners )
{ {
bb.add( corner ); size_t cellIndex = m_mainGrid->cellIndexFromIJK( i, j, k );
std::array<cvf::Vec3d, 8> hexCorners;
m_mainGrid->cellCornerVertices( cellIndex, hexCorners.data() );
for ( const auto& corner : hexCorners )
{
bb.add( corner );
}
} }
} }
} }