From f967cfcb65b731f73b297b87b6ae0c709b5c9302 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Mon, 28 Sep 2020 13:10:42 +0200 Subject: [PATCH] #6517 Apply fudge factor to maximum contour level in Contour maps * This is already done to the minimum level. * Probably only a real issue for results with a [0..1] range because these results have a lot of cells with values near the top part of the interval. --- .../ProjectDataModel/RimContourMapProjection.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp index 2bc3509a8f..2938eec0b3 100644 --- a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp @@ -976,11 +976,11 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() std::vector clippedTriangle; if ( v == clippedPolygon.size() - 1 ) { - clippedTriangle = {clippedPolygon[v], clippedPolygon[0], baryCenter}; + clippedTriangle = { clippedPolygon[v], clippedPolygon[0], baryCenter }; } else { - clippedTriangle = {clippedPolygon[v], clippedPolygon[v + 1], baryCenter}; + clippedTriangle = { clippedPolygon[v], clippedPolygon[v + 1], baryCenter }; } polygonTriangles.push_back( clippedTriangle ); } @@ -1106,7 +1106,10 @@ void RimContourMapProjection::generateContourPolygons() if ( legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LINEAR_DISCRETE || legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LINEAR_CONTINUOUS ) { - contourLevels.front() -= 0.01 * ( contourLevels.back() - contourLevels.front() ); + const int fudgeFactor = 0.01; + // Adjust contour levels slightly to avoid weird visual artifacts due to numerical error. + contourLevels.front() -= fudgeFactor * ( contourLevels.back() - contourLevels.front() ); + contourLevels.back() += fudgeFactor * ( contourLevels.back() - contourLevels.front() ); } else {