diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp index 07f8789d71..02590b7e91 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp @@ -188,7 +188,7 @@ void RivFemPartGeometryGenerator::computeArrays() trianglesToElements.reserve(estimatedQuadVxCount/2); trianglesToElementFaces.reserve(estimatedQuadVxCount/2); - cvf::Vec3d offset = Vec3d::ZERO; //m_part->displayModelOffset(); + cvf::Vec3d displayOffset = m_part->boundingBox().min(); const std::vector& nodeCoordinates = m_part->nodes().coordinates; #pragma omp parallel for schedule(dynamic) @@ -217,12 +217,10 @@ void RivFemPartGeometryGenerator::computeArrays() if (faceNodeCount == 4) { - const cvf::Vec3f* quadVxs[4]; - - quadVxs[0] = &(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[0]] ]); - quadVxs[1] = &(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[1]] ]); - quadVxs[2] = &(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[2]] ]); - quadVxs[3] = &(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[3]] ]); + cvf::Vec3f quadVxs0 ( cvf::Vec3d(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[0]] ]) - displayOffset); + cvf::Vec3f quadVxs1 ( cvf::Vec3d(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[1]] ]) - displayOffset); + cvf::Vec3f quadVxs2 ( cvf::Vec3d(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[2]] ]) - displayOffset); + cvf::Vec3f quadVxs3 ( cvf::Vec3d(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[3]] ]) - displayOffset); int qNodeIdx[4]; qNodeIdx[0] = elmNodeIndices[localElmNodeIndicesForFace[0]]; @@ -238,10 +236,10 @@ void RivFemPartGeometryGenerator::computeArrays() #pragma omp critical { - vertices.push_back(*quadVxs[0]); - vertices.push_back(*quadVxs[1]); - vertices.push_back(*quadVxs[2]); - vertices.push_back(*quadVxs[3]); + vertices.push_back(quadVxs0); + vertices.push_back(quadVxs1); + vertices.push_back(quadVxs2); + vertices.push_back(quadVxs3); m_quadVerticesToNodeIdx.push_back(qNodeIdx[0]); m_quadVerticesToNodeIdx.push_back(qNodeIdx[1]); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 90b3360c8c..2e4dd648f1 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -399,6 +399,14 @@ double RimGeoMechCase::frictionAngleDeg() const return m_frictionAngleDeg; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RimGeoMechCase::displayModelOffset() const +{ + return this->allCellsBoundingBox().min(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index 13c6b897d4..3caae63564 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -78,7 +78,11 @@ public: caf::PdmChildArrayField geoMechViews; + + + private: + virtual cvf::Vec3d displayModelOffset() const override; static std::vector dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;