#2628 3D well log curves: Scale curves by grid size

This commit is contained in:
Unknown 2018-03-20 15:36:57 +01:00 committed by unknown
parent a86fe5deb9
commit 0de43ac938
3 changed files with 72 additions and 60 deletions

View File

@ -104,14 +104,15 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
cvf::uint counter = 0; cvf::uint counter = 0;
double offsetFromWellPathCenter = wellPathRadius()*1.2; double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
double gridWidth = 100;
// Normal lines // Normal lines
for (size_t i = 0; i < pointNormals.size(); i++) for (size_t i = 0; i < pointNormals.size(); i++)
{ {
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(gridPoints[i] + pointNormals[i] * offsetFromWellPathCenter))); vertices.push_back(cvf::Vec3f(
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(gridPoints[i] + pointNormals[i] * (offsetFromWellPathCenter+gridWidth)))); displayCoordTransform->transformToDisplayCoord(gridPoints[i] + pointNormals[i] * offsetFromWellPathCenter)));
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
gridPoints[i] + pointNormals[i] * (offsetFromWellPathCenter + gridWidth()))));
indices.push_back(counter++); indices.push_back(counter++);
indices.push_back(counter++); indices.push_back(counter++);
@ -122,7 +123,8 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
// Line along and close to well // Line along and close to well
for (size_t i = 0; i < wellPathPoints.size(); i++) for (size_t i = 0; i < wellPathPoints.size(); i++)
{ {
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(wellPathPoints[i] + wellPathSegmentNormals[i] * offsetFromWellPathCenter))); vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
wellPathPoints[i] + wellPathSegmentNormals[i] * offsetFromWellPathCenter)));
indices.push_back(counter); indices.push_back(counter);
indices.push_back(++counter); indices.push_back(++counter);
} }
@ -132,7 +134,8 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
// Line along and far away from well // Line along and far away from well
for (size_t i = 0; i < wellPathPoints.size(); i++) for (size_t i = 0; i < wellPathPoints.size(); i++)
{ {
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(wellPathPoints[i] + wellPathSegmentNormals[i] * (offsetFromWellPathCenter + gridWidth)))); vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
wellPathPoints[i] + wellPathSegmentNormals[i] * (offsetFromWellPathCenter + gridWidth()))));
indices.push_back(counter); indices.push_back(counter);
indices.push_back(++counter); indices.push_back(++counter);
} }
@ -197,26 +200,20 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
vertices->resize(interpolatedWellPathPoints.size()); vertices->resize(interpolatedWellPathPoints.size());
double range = maxResult - minResult; double plotRangeToResultRangeFactor = gridWidth() / (maxResult - minResult);
double offset = wellPathRadius()*1.2; double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
double factor = 2 * offset / range;
if (minResult < 0)
{
offset += cvf::Math::abs(minResult * factor);
}
for (size_t i = 0; i < pointNormals.size(); i++) for (size_t i = 0; i < pointNormals.size(); i++)
{ {
cvf::Vec3d result(0, 0, 0); double scaledResult = 0;
if (RigCurveDataTools::isValidValue(resultValues[i], false)) if (RigCurveDataTools::isValidValue(resultValues[i], false))
{ {
result = resultValues[i] * factor * pointNormals[i]; scaledResult = offsetFromWellPathCenter + (resultValues[i] - minResult) * plotRangeToResultRangeFactor;
} }
(*vertices)[i] = cvf::Vec3f( (*vertices)[i] = cvf::Vec3f(
displayCoordTransform->transformToDisplayCoord(interpolatedWellPathPoints[i] + pointNormals[i] * offset + result)); displayCoordTransform->transformToDisplayCoord(interpolatedWellPathPoints[i] + scaledResult * pointNormals[i]));
} }
std::vector<std::pair<size_t, size_t>> valuesIntervals = std::vector<std::pair<size_t, size_t>> valuesIntervals =
@ -300,7 +297,8 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculatePointNormal
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateWellPathSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane) const std::vector<cvf::Vec3d>
Riv3dWellLogCurveGeometryGenerator::calculateWellPathSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane) const
{ {
std::vector<cvf::Vec3d> wellSegmentNormals; std::vector<cvf::Vec3d> wellSegmentNormals;
@ -313,7 +311,7 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateWellPathSeg
cvf::Vec3d normal; cvf::Vec3d normal;
for (size_t i = 0; i < wellPathPoints.size()-1; i++) for (size_t i = 0; i < wellPathPoints.size() - 1; i++)
{ {
cvf::Vec3d p1 = wellPathPoints[i]; cvf::Vec3d p1 = wellPathPoints[i];
cvf::Vec3d p2 = wellPathPoints[i + 1]; cvf::Vec3d p2 = wellPathPoints[i + 1];
@ -338,7 +336,6 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateWellPathSeg
cvf::Vec3d Ey = (up ^ Ex).getNormalized(); cvf::Vec3d Ey = (up ^ Ex).getNormalized();
cvf::Vec3d Ez = (Ex ^ Ey).getNormalized(); cvf::Vec3d Ez = (Ex ^ Ey).getNormalized();
switch (drawPlane) switch (drawPlane)
{ {
case Rim3dWellLogCurve::HORIZONTAL_LEFT: case Rim3dWellLogCurve::HORIZONTAL_LEFT:
@ -368,11 +365,19 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateWellPathSeg
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double Riv3dWellLogCurveGeometryGenerator::wellPathRadius() const double Riv3dWellLogCurveGeometryGenerator::wellPathCenterToPlotStartOffset() const
{ {
double cellSize = m_gridView->ownerCase()->characteristicCellSize(); double cellSize = m_gridView->ownerCase()->characteristicCellSize();
return m_wellPath->wellPathRadius(cellSize); return m_wellPath->wellPathRadius(cellSize) * 1.2;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Riv3dWellLogCurveGeometryGenerator::gridWidth() const
{
return 100;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -62,7 +62,8 @@ private:
std::vector<cvf::Vec3d> calculateWellPathSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane) const; std::vector<cvf::Vec3d> calculateWellPathSegmentNormals(Rim3dWellLogCurve::DrawPlane drawPlane) const;
double wellPathRadius() const; double wellPathCenterToPlotStartOffset() const;
double gridWidth() const;
const RigWellPath* wellPathGeometry() const; const RigWellPath* wellPathGeometry() const;

View File

@ -49,7 +49,10 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
if (rim3dWellLogCurves.empty()) return; if (rim3dWellLogCurves.empty()) return;
if (m_wellPath.isNull()) return; if (m_wellPath.isNull()) return;
if (m_3dWellLogCurveGeometryGenerator.isNull())
{
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView); m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView);
}
for (Rim3dWellLogCurve* rim3dWellLogCurve : rim3dWellLogCurves) for (Rim3dWellLogCurve* rim3dWellLogCurve : rim3dWellLogCurves)
{ {
@ -94,7 +97,10 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double gridIntervalSize) void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double gridIntervalSize)
{ {
if (m_3dWellLogCurveGeometryGenerator.isNull()) return; if (m_3dWellLogCurveGeometryGenerator.isNull())
{
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView);
}
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f)); caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));