Intersection : Add Python support for triangle and result values (#8505)

#8508 Python : Make sure an empty list will be received as empty list in Python

Co-authored-by: magnesj <magnesj@users.noreply.github.com>
This commit is contained in:
Magne Sjaastad
2022-02-07 18:38:19 +01:00
committed by GitHub
parent 316cb222d9
commit 64bed86f8f
21 changed files with 722 additions and 28 deletions

View File

@@ -478,6 +478,15 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
point1 = point1.getTransformedPoint( invSectionCS );
point2 = point2.getTransformedPoint( invSectionCS );
if ( m_isFlattened )
{
// The points are transformed in to the XZ-plane with Y = zero.
// Set all y values to zero to avoid numerical issues
point0.y() = 0.0;
point1.y() = 0.0;
point2.y() = 0.0;
}
triangleVertices.emplace_back( point0 );
triangleVertices.emplace_back( point1 );
triangleVertices.emplace_back( point2 );
@@ -765,6 +774,31 @@ const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::triangleVx
return m_triangleVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::cellMeshVxes() const
{
CVF_ASSERT( m_cellBorderLineVxes->size() );
return m_cellBorderLineVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::faultMeshVxes() const
{
return m_faultCellBorderLineVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::ensureGeometryIsCalculated()
{
calculateArrays();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -81,6 +81,10 @@ public:
const std::vector<size_t>& triangleToCellIndex() const override;
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const override;
const cvf::Vec3fArray* triangleVxes() const override;
const cvf::Vec3fArray* cellMeshVxes() const override;
const cvf::Vec3fArray* faultMeshVxes() const override;
void ensureGeometryIsCalculated();
private:
void calculateArrays();

View File

@@ -27,8 +27,11 @@
class RivIntersectionGeometryGeneratorInterface
{
public:
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual ~RivIntersectionGeometryGeneratorInterface() = default;
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const = 0;
virtual const cvf::Vec3fArray* triangleVxes() const = 0;
virtual const cvf::Vec3fArray* cellMeshVxes() const { return nullptr; };
virtual const cvf::Vec3fArray* faultMeshVxes() const { return nullptr; };
};