From 181871f970916e45951c02b74073963dcd803f7e Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Fri, 24 Nov 2017 15:16:29 +0100 Subject: [PATCH] #2122 Intersection clip surface on tighter bounds than bounding box --- .../RivIntersectionGeometryGenerator.cpp | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp index fbab9f44a4..a7572e94bf 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp @@ -127,7 +127,6 @@ void RivIntersectionGeometryGenerator::calculateArrays() sectionBBox.add(p1 - maxHeightVec); sectionBBox.add(p2 + maxHeightVec); sectionBBox.add(p2 - maxHeightVec); - } @@ -165,6 +164,38 @@ void RivIntersectionGeometryGenerator::calculateArrays() &hexPlaneCutTriangleVxes, &isTriangleEdgeCellContour); + if (m_crossSection->type == RimIntersection::CS_AZIMUTHLINE) + { + bool hasAnyPointsOnSurface = false; + for (caf::HexGridIntersectionTools::ClipVx vertex : hexPlaneCutTriangleVxes) + { + cvf::Vec3d temp = vertex.vx - p1; + double dot = temp.dot(m_extrusionDirection); + double lengthCheck; + //if (vertex.vx.z() > p1.z()) + + if (dot < 0) + { + lengthCheck = maxSectionHeightUp; + } + else + { + lengthCheck = maxSectionHeightDown; + } + + double distance = cvf::Math::sqrt(cvf::GeometryTools::linePointSquareDist(p1, p2, vertex.vx)); + if (distance < lengthCheck) + { + hasAnyPointsOnSurface = true; + break; + } + } + if (!hasAnyPointsOnSurface) + { + continue; + } + } + std::vector clippedTriangleVxes; std::vector isClippedTriEdgeCellContour;