#5019 Position the separate source box/intersections correctly acc to displayOffset

This commit is contained in:
Jacob Støren 2019-11-20 09:37:08 +01:00
parent 439071dddf
commit 6e96570995
2 changed files with 29 additions and 5 deletions

View File

@ -18,12 +18,17 @@
#include "RivIntersectionBoxGeometryGenerator.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionBox.h"
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
#include "cvfDrawableGeo.h"
#include "cvfPlane.h"
#include "cvfPrimitiveSetDirect.h"
#include "cvfStructGrid.h"
#include <array>
//--------------------------------------------------------------------------------------------------
@ -245,8 +250,16 @@ void RivIntersectionBoxGeometryGenerator::calculateArrays()
std::vector<cvf::Vec3f> triangleVertices;
std::vector<cvf::Vec3f> cellBorderLineVxes;
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
cvf::Vec3d displayOffset( 0, 0, 0 );
{
RimGridView* gridView = nullptr;
m_intersectionBoxDefinition->firstAncestorOrThisOfType( gridView );
if ( gridView && gridView->ownerCase() )
{
displayOffset = gridView->ownerCase()->displayModelOffset();
}
}
Box box( m_intersectionBoxDefinition->boxOrigin(), m_intersectionBoxDefinition->boxSize() );
std::array<cvf::Plane, 6> boxPlanes = box.planes();

View File

@ -23,6 +23,8 @@
#include "RigResultAccessor.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RivHexGridIntersectionTools.h"
@ -107,7 +109,17 @@ void RivIntersectionGeometryGenerator::calculateSegementTransformPrLinePoint()
{
m_segementTransformPrLinePoint.clear();
cvf::Mat4d invSectionCS = cvf::Mat4d::fromTranslation( -m_hexGrid->displayOffset() );
cvf::Vec3d displayOffset( 0, 0, 0 );
{
RimGridView* gridView = nullptr;
m_crossSection->firstAncestorOrThisOfType( gridView );
if ( gridView && gridView->ownerCase() )
{
displayOffset = gridView->ownerCase()->displayModelOffset();
}
}
cvf::Mat4d invSectionCS = cvf::Mat4d::fromTranslation( -displayOffset );
for ( const auto& polyLine : m_polyLines )
{
@ -211,8 +223,7 @@ void RivIntersectionGeometryGenerator::calculateArrays()
MeshLinesAccumulator meshAcc( m_hexGrid.p() );
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
calculateSegementTransformPrLinePoint();
calculateFlattenedOrOffsetedPolyline();