#1646 Fix disappearing mesh lines by using double transformation calculations

This commit is contained in:
Jacob Støren
2017-06-23 10:16:39 +02:00
parent 63cf1e91b3
commit 7d7172f811
12 changed files with 62 additions and 57 deletions

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;