mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#2630, #2605 unfalltenedTransformMatrix now returns mx[0] and mx[last] for points before and after end.
This commit is contained in:
+11
-18
@@ -565,34 +565,27 @@ RimIntersection* RivIntersectionGeometryGenerator::crossSection() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::Mat4d RivIntersectionGeometryGenerator::unflattenTransformMatrix(const cvf::Vec3d& intersectionPointFlat)
|
cvf::Mat4d RivIntersectionGeometryGenerator::unflattenTransformMatrix(const cvf::Vec3d& intersectionPointFlat)
|
||||||
{
|
{
|
||||||
cvf::Vec3d startPt = cvf::Vec3d::ZERO;
|
cvf::Mat4d flattenMx = cvf::Mat4d::IDENTITY;
|
||||||
|
|
||||||
int polyLineIdx = -1;
|
for ( size_t pLineIdx = 0; pLineIdx < m_flattenedOrOffsettedPolyLines.size(); pLineIdx++ )
|
||||||
int segIdx = -1;
|
|
||||||
for (size_t pLineIdx = 0; pLineIdx < m_flattenedOrOffsettedPolyLines.size(); pLineIdx++)
|
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3d> polyLine = m_flattenedOrOffsettedPolyLines[pLineIdx];
|
const std::vector<cvf::Vec3d>& polyLine = m_flattenedOrOffsettedPolyLines[pLineIdx];
|
||||||
for(size_t pIdx = 0; pIdx < polyLine.size(); pIdx++)
|
for(size_t pIdx = 0; pIdx < polyLine.size(); pIdx++)
|
||||||
{
|
{
|
||||||
// Assumes ascending sorted list
|
if (polyLine[pIdx].x() >= intersectionPointFlat.x() )
|
||||||
if (pIdx > 0 && intersectionPointFlat.x() < polyLine[pIdx].x())
|
|
||||||
{
|
{
|
||||||
polyLineIdx = static_cast<int>(pLineIdx);
|
size_t csIdx = pIdx > 0 ? pIdx - 1: 0;
|
||||||
segIdx = static_cast<int>(pIdx) - 1;
|
flattenMx = m_segementTransformPrLinePoint[pLineIdx][csIdx];
|
||||||
startPt = polyLine[segIdx];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (pIdx == polyLine.size() - 1)
|
||||||
|
{
|
||||||
|
flattenMx = m_segementTransformPrLinePoint[pLineIdx][pIdx];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startPt.isZero()) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polyLineIdx > -1 && segIdx > -1)
|
return flattenMx.getInverted();
|
||||||
{
|
|
||||||
cvf::Mat4d t = m_segementTransformPrLinePoint[polyLineIdx][segIdx];
|
|
||||||
return t.getInverted(); // Check for invertible?
|
|
||||||
}
|
|
||||||
return cvf::Mat4d::ZERO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user