From: Paul RASCLE Date: Wed, 10 May 2017 06:34:17 +0000 (+0200) Subject: limite hauteur interpolation stream X-Git-Tag: Salome_8_3_Hydro_1_1rc1~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=10771d9fbe730be44e116052b3833e9a31cd9986;p=modules%2Fhydro.git limite hauteur interpolation stream --- diff --git a/src/HYDROData/HYDROData_DTM.cxx b/src/HYDROData/HYDROData_DTM.cxx index e8663739..b31cdbcf 100644 --- a/src/HYDROData/HYDROData_DTM.cxx +++ b/src/HYDROData/HYDROData_DTM.cxx @@ -61,8 +61,8 @@ IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry ) -HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ ) - : myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ ) +HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ, double theMaxZ ) + : myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ ), myMaxZ (theMaxZ) { } @@ -85,9 +85,14 @@ double HYDROData_DTM::CurveUZ::DeltaZ() const return myDeltaZ; } +double HYDROData_DTM::CurveUZ::MaxZ() const +{ + return myMaxZ; +} + HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) const { - HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir(), DeltaZ() + c.DeltaZ() ); + HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir(), DeltaZ() + c.DeltaZ(), MaxZ() + c.MaxZ() ); size_t n = size(), n1 = c.size(); if( n!=n1 ) { @@ -106,7 +111,7 @@ HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) c HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator * ( double d ) const { - HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d, DeltaZ()*d ); + HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d, DeltaZ()*d, MaxZ()*d ); size_t n = size(); res.reserve( n ); for( int i=0; i& intersections, double& theMid, double } void HYDROData_DTM::ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile, - double theXCurv, double theMinZ, double theMaxZ, double theDDZ, + double theXCurv, double theMinZ, double theMaxZ, double theTopZ, double theDDZ, CurveUZ& theMidPointCurve, CurveUZ& theWidthCurve, int& intersection_nb, @@ -704,9 +709,9 @@ void HYDROData_DTM::ProfileDiscretization( const Handle(HYDROData_Profile)& theP curves.push_back( aT2 ); int psize = ( int )( ( theMaxZ-theMinZ ) / theDDZ + 1 ); - theMidPointCurve = CurveUZ( theXCurv, aProfileDir, theMinZ ); + theMidPointCurve = CurveUZ( theXCurv, aProfileDir, theMinZ, theTopZ); theMidPointCurve.reserve( psize ); - theWidthCurve = CurveUZ( theXCurv, aProfileDir, theMinZ ); + theWidthCurve = CurveUZ( theXCurv, aProfileDir, theMinZ, theTopZ ); theWidthCurve.reserve( psize ); n = curves.size(); @@ -780,7 +785,8 @@ void HYDROData_DTM::CurveTo3D( const Handle(Geom2d_BSplineCurve)& theHydraulicAx size_t n = theMidCurve.size(); std::map sorted_points; - for( size_t i=0; i HYDROData_DTM::Interpolate //double zmin = min( zminA, zminB ); //double zmax = max( zmaxA, zmaxB ); - CurveUZ midA(0, gp_Vec2d(), 0), midB(0, gp_Vec2d(), 0); - CurveUZ widA(0, gp_Vec2d(), 0), widB(0, gp_Vec2d(), 0); + CurveUZ midA(0, gp_Vec2d(), 0, 0), midB(0, gp_Vec2d(), 0, 0); + CurveUZ widA(0, gp_Vec2d(), 0, 0), widB(0, gp_Vec2d(), 0, 0); - ProfileDiscretization( theProfileA, theXCurvA, zminA, zminA+hmax, theDDZ, midA, widA, inter_nb_1 ); - ProfileDiscretization( theProfileB, theXCurvB, zminB, zminB+hmax, theDDZ, midB, widB, inter_nb_2 ); + ProfileDiscretization( theProfileA, theXCurvA, zminA, zminA+hmax, zmaxA-zminA, theDDZ, midA, widA, inter_nb_1 ); + ProfileDiscretization( theProfileB, theXCurvB, zminB, zminB+hmax, zmaxB-zminB, theDDZ, midB, widB, inter_nb_2 ); std::vector mid, wid; Interpolate( midA, midB, theNbSteps, mid, isAddSecond ); diff --git a/src/HYDROData/HYDROData_DTM.h b/src/HYDROData/HYDROData_DTM.h index 7f2de733..59d3cd68 100644 --- a/src/HYDROData/HYDROData_DTM.h +++ b/src/HYDROData/HYDROData_DTM.h @@ -90,12 +90,13 @@ public: class CurveUZ : public std::vector { public: - CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ ); + CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ, double theMaxZ ); ~CurveUZ(); double Xcurv() const; gp_Vec2d ProfileDir() const; double DeltaZ() const; + double MaxZ() const; CurveUZ operator + ( const CurveUZ& ) const; CurveUZ operator * ( double ) const; @@ -104,6 +105,7 @@ public: double myXcurv; gp_Vec2d myProfileDir; double myDeltaZ; + double myMaxZ; }; protected: @@ -127,7 +129,7 @@ protected: double& theZMin, double& theZMax ); static void ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile, - double theXCurv, double theMinZ, double theMaxZ, double theDDZ, + double theXCurv, double theMinZ, double theMaxZ, double theTopZ, double theDDZ, CurveUZ& theMidPointCurve, CurveUZ& theWidthCurve, int& intersection_nb, diff --git a/src/HYDRO_tests/test_HYDROData_DTM.cxx b/src/HYDRO_tests/test_HYDROData_DTM.cxx index 74bf64ba..d4338722 100644 --- a/src/HYDRO_tests/test_HYDROData_DTM.cxx +++ b/src/HYDRO_tests/test_HYDROData_DTM.cxx @@ -339,9 +339,9 @@ void test_HYDROData_DTM::test_profile_discretization_polyline() aProfile->SetLeftPoint( gp_XY( 10, 10 ) ); aProfile->SetRightPoint( gp_XY( 20, 20 ) ); - HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 ); + HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0, 0 ), aWid( 0.0, gp_Vec2d(), 0, 0 ); int dummy = 0; - HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy ); + HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 5.0, 0.5, aMid, aWid, dummy ); CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].U, EPS ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS ); @@ -377,9 +377,9 @@ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); aProfile->SetLeftPoint( gp_XY( 10, 10 ) ); aProfile->SetRightPoint( gp_XY( 20, 20 ) ); - HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 ); + HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0, 0 ), aWid( 0.0, gp_Vec2d(), 0, 0 ); int dummy = 0 ; - HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy ); + HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 5.0, 0.5, aMid, aWid, dummy ); CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.242, aMid[0].U, EPS ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS ); @@ -432,7 +432,7 @@ void operator << ( std::ostream& s, const HYDROData_DTM::CurveUZ& c ) void test_HYDROData_DTM::test_curves_interpolation() { - HYDROData_DTM::CurveUZ A(1.0, gp_Vec2d(), 0), B(2.0, gp_Vec2d(), 0); + HYDROData_DTM::CurveUZ A(1.0, gp_Vec2d(), 0, 0), B(2.0, gp_Vec2d(), 0, 0); A.push_back( HYDROData_DTM::PointUZ( 0, 0 ) ); A.push_back( HYDROData_DTM::PointUZ( 1, 1 ) ); A.push_back( HYDROData_DTM::PointUZ( 2, 2 ) ); @@ -499,10 +499,10 @@ void test_HYDROData_DTM::test_curve_to_3d() Handle(Geom2d_BSplineCurve) HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances ); HYDROData_DTM::AltitudePoints points; - HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0 ); + HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0, 0 ); mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) ); mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) ); - HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0 ); + HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0, 0 ); wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) ); wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) ); HYDROData_DTM::CurveTo3D( HA, mid, wid, points );