mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#2591 3D well log curves: Use an angle to deretmine draw plane
This commit is contained in:
parent
26d83983b1
commit
9e4d271d5b
@ -48,12 +48,15 @@ Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator(RimWellPa
|
||||
cvf::ref<cvf::DrawableGeo>
|
||||
Riv3dWellLogCurveGeometryGenerator::createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const
|
||||
const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double rotationAngle) const
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
std::vector<cvf::uint> indices;
|
||||
|
||||
createCurveVerticesAndIndices(rim3dWellLogCurve, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
|
||||
createCurveVerticesAndIndices(
|
||||
resultValues, resultMds, rotationAngle, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
|
||||
|
||||
if (vertices.empty() || indices.empty())
|
||||
{
|
||||
@ -79,8 +82,8 @@ cvf::ref<cvf::DrawableGeo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
double gridIntervalSize) const
|
||||
double angle,
|
||||
double gridIntervalSize) const
|
||||
{
|
||||
CVF_ASSERT(gridIntervalSize > 0);
|
||||
|
||||
@ -126,7 +129,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
std::vector<cvf::Vec3d> closestPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&closestPoints, gridPoints);
|
||||
|
||||
pointNormals = calculateLineSegmentNormals(drawPlane, closestPoints, LINE_SEGMENTS);
|
||||
pointNormals = calculateLineSegmentNormals(angle, closestPoints, LINE_SEGMENTS);
|
||||
if (pointNormals.size() != gridPoints.size()) return nullptr;
|
||||
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
@ -154,7 +157,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
|
||||
// calculateLineSegmentNormals returns normals for the whole well path. Erase the part which is clipped off
|
||||
std::vector<cvf::Vec3d> wellPathSegmentNormals =
|
||||
calculateLineSegmentNormals(drawPlane, wellPathGeometry()->m_wellPathPoints, POLYLINE);
|
||||
calculateLineSegmentNormals(angle, wellPathGeometry()->m_wellPathPoints, POLYLINE);
|
||||
wellPathSegmentNormals.erase(wellPathSegmentNormals.begin(), wellPathSegmentNormals.end() - wellPathPoints.size());
|
||||
|
||||
// Line along and close to well
|
||||
@ -200,7 +203,9 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
|
||||
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double angle,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
@ -210,10 +215,6 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
if (wellPathGeometry()->m_wellPathPoints.empty()) return;
|
||||
if (!wellPathClipBoundingBox.isValid()) return;
|
||||
|
||||
std::vector<double> resultValues;
|
||||
std::vector<double> resultMds;
|
||||
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
|
||||
|
||||
if (resultValues.empty()) return;
|
||||
CVF_ASSERT(resultValues.size() == resultMds.size());
|
||||
|
||||
@ -243,23 +244,23 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
interpolatedWellPathPoints.pop_back();
|
||||
}
|
||||
|
||||
// Reverse list, since it was filled in the wrong order
|
||||
// Reverse list, since it was filled in the opposite order
|
||||
std::reverse(interpolatedWellPathPoints.begin(), interpolatedWellPathPoints.end());
|
||||
|
||||
// Erase the result values for the part of the well which is clipped off, to match interpolatedWellPathPoints size
|
||||
resultValues.erase(resultValues.begin(), resultValues.end() - interpolatedWellPathPoints.size());
|
||||
// The result values for the part of the well which is not clipped off, matching interpolatedWellPathPoints size
|
||||
std::vector<double> resultValuesForInterpolatedPoints(resultValues.end() - interpolatedWellPathPoints.size(),
|
||||
resultValues.end());
|
||||
|
||||
std::vector<cvf::Vec3d> pairsOfWellPathPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&pairsOfWellPathPoints, interpolatedWellPathPoints);
|
||||
|
||||
std::vector<cvf::Vec3d> pointNormals =
|
||||
calculateLineSegmentNormals(rim3dWellLogCurve->drawPlane(), pairsOfWellPathPoints, LINE_SEGMENTS);
|
||||
std::vector<cvf::Vec3d> pointNormals = calculateLineSegmentNormals(angle, pairsOfWellPathPoints, LINE_SEGMENTS);
|
||||
if (interpolatedWellPathPoints.size() != pointNormals.size()) return;
|
||||
|
||||
double maxResult = -HUGE_VAL;
|
||||
double minResult = HUGE_VAL;
|
||||
|
||||
for (double result : resultValues)
|
||||
for (double result : resultValuesForInterpolatedPoints)
|
||||
{
|
||||
if (!RigCurveDataTools::isValidValue(result, false)) continue;
|
||||
|
||||
@ -276,9 +277,10 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
{
|
||||
double scaledResult = 0;
|
||||
|
||||
if (RigCurveDataTools::isValidValue(resultValues[i], false))
|
||||
if (RigCurveDataTools::isValidValue(resultValuesForInterpolatedPoints[i], false))
|
||||
{
|
||||
scaledResult = offsetFromWellPathCenter + (resultValues[i] - minResult) * plotRangeToResultRangeFactor;
|
||||
scaledResult =
|
||||
offsetFromWellPathCenter + (resultValuesForInterpolatedPoints[i] - minResult) * plotRangeToResultRangeFactor;
|
||||
}
|
||||
|
||||
(*vertices)[i] = cvf::Vec3f(
|
||||
@ -286,7 +288,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
}
|
||||
|
||||
std::vector<std::pair<size_t, size_t>> valuesIntervals =
|
||||
RigCurveDataTools::calculateIntervalsOfValidValues(resultValues, false);
|
||||
RigCurveDataTools::calculateIntervalsOfValidValues(resultValuesForInterpolatedPoints, false);
|
||||
|
||||
for (const std::pair<size_t, size_t>& interval : valuesIntervals)
|
||||
{
|
||||
@ -301,7 +303,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateLineSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateLineSegmentNormals(double angle,
|
||||
const std::vector<cvf::Vec3d>& vertices,
|
||||
VertexOrganization organization) const
|
||||
{
|
||||
@ -352,23 +354,8 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateLineSegment
|
||||
cvf::Vec3d Ey = (up ^ Ex).getNormalized();
|
||||
cvf::Vec3d Ez = (Ex ^ Ey).getNormalized();
|
||||
|
||||
switch (drawPlane)
|
||||
{
|
||||
case Rim3dWellLogCurve::HORIZONTAL_LEFT:
|
||||
normal = -Ey;
|
||||
break;
|
||||
case Rim3dWellLogCurve::HORIZONTAL_RIGHT:
|
||||
normal = Ey;
|
||||
break;
|
||||
case Rim3dWellLogCurve::VERTICAL_ABOVE:
|
||||
normal = Ez;
|
||||
break;
|
||||
case Rim3dWellLogCurve::VERTICAL_BELOW:
|
||||
normal = -Ez;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cvf::Mat3d rotation;
|
||||
normal = Ey.getTransformedVector(rotation.fromRotation(Ex, angle));
|
||||
|
||||
pointNormals.push_back(normal);
|
||||
}
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
@ -50,11 +48,13 @@ public:
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const;
|
||||
const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double rotationAngle) const;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
double angle,
|
||||
double gridIntervalSize) const;
|
||||
|
||||
private:
|
||||
@ -65,13 +65,15 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
void createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
|
||||
void createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double angle,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
std::vector<cvf::uint>* indices) const;
|
||||
|
||||
std::vector<cvf::Vec3d> calculateLineSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
std::vector<cvf::Vec3d> calculateLineSegmentNormals(double angle,
|
||||
const std::vector<cvf::Vec3d>& vertices,
|
||||
VertexOrganization organization) const;
|
||||
|
||||
|
@ -50,9 +50,9 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList*
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox)
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()) return;
|
||||
|
||||
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()->showPlot()) return;
|
||||
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
|
||||
@ -95,8 +95,12 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
{
|
||||
if (!rim3dWellLogCurve->toggleState()) continue;
|
||||
|
||||
cvf::ref<cvf::Drawable> curveDrawable =
|
||||
m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve);
|
||||
std::vector<double> resultValues;
|
||||
std::vector<double> resultMds;
|
||||
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
|
||||
|
||||
cvf::ref<cvf::Drawable> curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(
|
||||
displayCoordTransform, wellPathClipBoundingBox, resultValues, resultMds, angle(rim3dWellLogCurve->drawPlane()));
|
||||
|
||||
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
|
||||
{
|
||||
@ -133,11 +137,31 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane& drawPlane,
|
||||
double gridIntervalSize)
|
||||
double Riv3dWellLogPlanePartMgr::angle(const Rim3dWellLogCurve::DrawPlane& drawPlane)
|
||||
{
|
||||
switch (drawPlane)
|
||||
{
|
||||
case Rim3dWellLogCurve::HORIZONTAL_LEFT:
|
||||
return cvf::PI_D;
|
||||
case Rim3dWellLogCurve::HORIZONTAL_RIGHT:
|
||||
return 0.0;
|
||||
case Rim3dWellLogCurve::VERTICAL_ABOVE:
|
||||
return cvf::PI_D / 2.0;
|
||||
case Rim3dWellLogCurve::VERTICAL_BELOW:
|
||||
return -cvf::PI_D / 2.0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane& drawPlane,
|
||||
double gridIntervalSize)
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
@ -150,7 +174,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
|
||||
{
|
||||
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(
|
||||
displayCoordTransform, wellPathClipBoundingBox, drawPlane, gridIntervalSize);
|
||||
displayCoordTransform, wellPathClipBoundingBox, angle(drawPlane), gridIntervalSize);
|
||||
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
@ -65,6 +65,8 @@ private:
|
||||
double gridIntervalSize);
|
||||
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
||||
|
||||
static double angle(const Rim3dWellLogCurve::DrawPlane& drawPlane);
|
||||
|
||||
private:
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user