mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3498 Implement 2d grid projection prototype with regular grid.
This commit is contained in:
@@ -119,6 +119,36 @@ size_t RigMainGrid::findReservoirCellIndexFromPoint(const cvf::Vec3d& point) con
|
||||
return cellContainingPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RigMainGrid::findAllReservoirCellIndicesMatching2dPoint(const cvf::Vec2d& point2d) const
|
||||
{
|
||||
cvf::BoundingBox gridBoundingVox = boundingBox();
|
||||
cvf::Vec3d highestPoint(point2d, gridBoundingVox.max().z());
|
||||
cvf::Vec3d lowestPoint (point2d, gridBoundingVox.min().z());
|
||||
|
||||
cvf::BoundingBox rayBBox;
|
||||
rayBBox.add(highestPoint);
|
||||
rayBBox.add(lowestPoint);
|
||||
|
||||
std::vector<size_t> cellIndices;
|
||||
m_mainGrid->findIntersectingCells(rayBBox, &cellIndices);
|
||||
|
||||
cvf::Vec3d hexCorners[8];
|
||||
for (size_t cellIndex : cellIndices)
|
||||
{
|
||||
m_mainGrid->cellCornerVertices(cellIndex, hexCorners);
|
||||
|
||||
if (RigHexIntersectionTools::lineIntersectsHexCell(highestPoint, lowestPoint, hexCorners))
|
||||
{
|
||||
cellIndices.push_back(cellIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return cellIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user