#2122 Intersection clip surface on tighter bounds than bounding box

This commit is contained in:
Rebecca Cox 2017-11-24 15:16:29 +01:00
parent e765a9ad59
commit 181871f970

View File

@ -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<caf::HexGridIntersectionTools::ClipVx> clippedTriangleVxes;
std::vector<bool> isClippedTriEdgeCellContour;