mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1646 Fix disappearing mesh lines by using double transformation calculations
This commit is contained in:
@@ -163,9 +163,9 @@ void RimCompletionCellIntersectionCalc::calculateFractureIntersections(const Rig
|
||||
std::vector<cvf::Vec3d> fractureCellTransformed;
|
||||
for (const auto& v : fractureCell.getPolygon())
|
||||
{
|
||||
cvf::Vec3f polygonNode = cvf::Vec3f(v);
|
||||
cvf::Vec3d polygonNode = v;
|
||||
polygonNode.transformPoint(fracture->transformMatrix());
|
||||
fractureCellTransformed.push_back(cvf::Vec3d(polygonNode));
|
||||
fractureCellTransformed.push_back(polygonNode);
|
||||
}
|
||||
|
||||
std::vector<size_t> potentialCells;
|
||||
|
||||
@@ -230,25 +230,25 @@ cvf::Vec3d RimFracture::anchorPosition() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Mat4f RimFracture::transformMatrix() const
|
||||
cvf::Mat4d RimFracture::transformMatrix() const
|
||||
{
|
||||
cvf::Vec3d center = anchorPosition();
|
||||
|
||||
// Dip (in XY plane)
|
||||
cvf::Mat4f dipRotation = cvf::Mat4f::fromRotation(cvf::Vec3f::Z_AXIS, cvf::Math::toRadians(dip()));
|
||||
cvf::Mat4d dipRotation = cvf::Mat4d::fromRotation(cvf::Vec3d::Z_AXIS, cvf::Math::toRadians(dip()));
|
||||
|
||||
// Dip (out of XY plane)
|
||||
cvf::Mat4f tiltRotation = cvf::Mat4f::fromRotation(cvf::Vec3f::X_AXIS, cvf::Math::toRadians(tilt()));
|
||||
cvf::Mat4d tiltRotation = cvf::Mat4d::fromRotation(cvf::Vec3d::X_AXIS, cvf::Math::toRadians(tilt()));
|
||||
|
||||
|
||||
// Ellipsis geometry is produced in XY-plane, rotate 90 deg around X to get zero azimuth along Y
|
||||
cvf::Mat4f rotationFromTesselator = cvf::Mat4f::fromRotation(cvf::Vec3f::X_AXIS, cvf::Math::toRadians(90.0f));
|
||||
cvf::Mat4d rotationFromTesselator = cvf::Mat4d::fromRotation(cvf::Vec3d::X_AXIS, cvf::Math::toRadians(90.0f));
|
||||
|
||||
// Azimuth rotation
|
||||
cvf::Mat4f azimuthRotation = cvf::Mat4f::fromRotation(cvf::Vec3f::Z_AXIS, cvf::Math::toRadians(-azimuth()-90));
|
||||
cvf::Mat4d azimuthRotation = cvf::Mat4d::fromRotation(cvf::Vec3d::Z_AXIS, cvf::Math::toRadians(-azimuth()-90));
|
||||
|
||||
cvf::Mat4f m = azimuthRotation * rotationFromTesselator * dipRotation * tiltRotation;
|
||||
m.setTranslation(cvf::Vec3f(center));
|
||||
cvf::Mat4d m = azimuthRotation * rotationFromTesselator * dipRotation * tiltRotation;
|
||||
m.setTranslation(center);
|
||||
|
||||
return m;
|
||||
}
|
||||
@@ -272,11 +272,15 @@ void RimFracture::triangleGeometry(std::vector<cvf::uint>* triangleIndices, std:
|
||||
fractureDef->fractureTriangleGeometry(nodeCoords, triangleIndices, fractureUnit());
|
||||
}
|
||||
|
||||
cvf::Mat4f m = transformMatrix();
|
||||
cvf::Mat4d m = transformMatrix();
|
||||
|
||||
for (cvf::Vec3f& v : *nodeCoords)
|
||||
{
|
||||
v.transformPoint(m);
|
||||
cvf::Vec3d vd(v);
|
||||
|
||||
vd.transformPoint(m);
|
||||
|
||||
v = cvf::Vec3f(vd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
size_t globalCellIndex) const;
|
||||
size_t findAnchorEclipseCell(const RigMainGrid* mainGrid) const;
|
||||
|
||||
cvf::Mat4f transformMatrix() const;
|
||||
cvf::Mat4d transformMatrix() const;
|
||||
|
||||
void setFractureTemplate(RimFractureTemplate* fractureTemplate);
|
||||
RimFractureTemplate* fractureTemplate() const;
|
||||
|
||||
Reference in New Issue
Block a user