mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3970 Contour Maps: improve edge look
* Remove excess tiny triangles around edges * Remove labels from contour lines that overlap inner contour lines
This commit is contained in:
@@ -156,6 +156,26 @@ double GeometryTools::getAngle(const cvf::Vec3d& v1, const cvf::Vec3d& v2)
|
||||
return angle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double GeometryTools::signedAreaPlanarPolygon(const cvf::Vec3d& planeNormal, const std::vector<cvf::Vec3d>& polygon)
|
||||
{
|
||||
int Z = findClosestAxis(planeNormal);
|
||||
int X = (Z + 1) % 3;
|
||||
int Y = (Z + 2) % 3;
|
||||
|
||||
// Use Shoelace formula to calculate signed area.
|
||||
// https://en.wikipedia.org/wiki/Shoelace_formula
|
||||
double signedArea = 0.0;
|
||||
for (size_t i = 0; i < polygon.size(); ++i)
|
||||
{
|
||||
signedArea += (polygon[(i + 1) % polygon.size()][X] - polygon[i][X]) *
|
||||
(polygon[(i + 1) % polygon.size()][Y] + polygon[i][Y]);
|
||||
}
|
||||
return signedArea;
|
||||
}
|
||||
|
||||
/*
|
||||
Determine the intersection point of two line segments
|
||||
From Paul Bourke, but modified to really handle coincident lines
|
||||
@@ -178,7 +198,7 @@ GeometryTools::IntersectionStatus inPlaneLineIntersect(
|
||||
numera = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3);
|
||||
numerb = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3);
|
||||
|
||||
double EPS = 1e-40;
|
||||
double EPS = 1e-40;
|
||||
|
||||
// Are the line coincident?
|
||||
if (fabs(numera) < EPS && fabs(numerb) < EPS && fabs(denom) < EPS)
|
||||
@@ -199,7 +219,7 @@ GeometryTools::IntersectionStatus inPlaneLineIntersect(
|
||||
|
||||
// Check if the p1 p2 line is a point
|
||||
|
||||
if (length12 < EPS )
|
||||
if (length12 < EPS)
|
||||
{
|
||||
*x = x1;
|
||||
*y = y1;
|
||||
|
||||
Reference in New Issue
Block a user