From 273437351f93566ed85a8e5bd05164a9e6ada407 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 7 Dec 2015 09:31:19 +0300 Subject: [PATCH] refs #751: more dense points distribution for the channel/digue creation on spline --- src/HYDROData/HYDROData_Channel.cxx | 9 ++++--- src/HYDROData/HYDROData_Polyline3D.cxx | 29 +++++++++++++++++++-- src/HYDROData/HYDROData_Polyline3D.h | 2 +- src/HYDRO_tests/reference_data/Channel.png | Bin 0 -> 9131 bytes 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 src/HYDRO_tests/reference_data/Channel.png diff --git a/src/HYDROData/HYDROData_Channel.cxx b/src/HYDROData/HYDROData_Channel.cxx index cd4800b4..3d18e28d 100644 --- a/src/HYDROData/HYDROData_Channel.cxx +++ b/src/HYDROData/HYDROData_Channel.cxx @@ -146,18 +146,19 @@ bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& int aNbPoints = aPolylinePoints.Length(); */ - HYDROData_Polyline3D::Polyline3DPoints aPolylinePoints3D = theGuideLine->GetPoints(); + double aEqDistance = 1; // TODO: to pass via properties and OCAF + HYDROData_Polyline3D::Polyline3DPoints aPolylinePoints3D = theGuideLine->GetPoints( aEqDistance ); int aNbPoints = aPolylinePoints3D.Length(); - if ( aNbPoints < 2 ) { + if ( aNbPoints < 2 ) return false; - } // Get tangent in each point of the guide line ( 2D ) TColgp_Array1OfDir aTangents( 1, aNbPoints ); HYDROData_IPolyline::SectionType aSectionType = aPolylineXY->GetSectionType( 0 ); - if ( aSectionType == HYDROData_IPolyline::SECTION_POLYLINE ) { + if( aSectionType == HYDROData_IPolyline::SECTION_POLYLINE ) + { for ( int i = 1; i <= aNbPoints; ++i ) { gp_XYZ aPnt = aPolylinePoints3D.Value( i ); aPnt.SetZ( 0. ); diff --git a/src/HYDROData/HYDROData_Polyline3D.cxx b/src/HYDROData/HYDROData_Polyline3D.cxx index 564f4f2c..70673480 100644 --- a/src/HYDROData/HYDROData_Polyline3D.cxx +++ b/src/HYDROData/HYDROData_Polyline3D.cxx @@ -29,6 +29,9 @@ #include #include +#include +#include +#include #include #include @@ -417,7 +420,7 @@ void HYDROData_Polyline3D::removeChildProfileUZ() */ } -HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints() const +HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints( double theEqDistance ) const { Polyline3DPoints aPoints; @@ -468,7 +471,29 @@ HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints() const } else { // Get points from spline curve Standard_Real aStart, anEnd; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve( TopoDS::Edge( anEdges.First() ), aStart, anEnd ); + TopoDS_Edge anEdge = TopoDS::Edge( anEdges.First() ); + Handle(Geom_Curve) aCurve = BRep_Tool::Curve( anEdge, aStart, anEnd ); + + if( theEqDistance > 0 ) + { + GeomAdaptor_Curve anAdaptorCurve( aCurve ); + double aLength = GCPnts_AbscissaPoint::Length( anAdaptorCurve ); + int aNbPoints = ceil( aLength / theEqDistance ); + GCPnts_QuasiUniformAbscissa aDist( anAdaptorCurve, aNbPoints ); + if( aDist.IsDone() ) + { + aNbPoints = aDist.NbPoints(); + for( int i=1; i<=aNbPoints; i++ ) + { + double p = aDist.Parameter( i ); + gp_Pnt aPnt; + aCurve->D0( p, aPnt ); + aPoints.Append( aPnt.XYZ() ); + } + return aPoints; + } + } + Handle(Geom_BSplineCurve) aGeomSpline = Handle(Geom_BSplineCurve)::DownCast( aCurve ); if ( !aGeomSpline.IsNull() ) { diff --git a/src/HYDROData/HYDROData_Polyline3D.h b/src/HYDROData/HYDROData_Polyline3D.h index 1705f29a..e90b1cec 100644 --- a/src/HYDROData/HYDROData_Polyline3D.h +++ b/src/HYDROData/HYDROData_Polyline3D.h @@ -149,7 +149,7 @@ public: * Returns list of polyline points. * \return list of 3D points */ - HYDRODATA_EXPORT Polyline3DPoints GetPoints() const; + HYDRODATA_EXPORT Polyline3DPoints GetPoints( double theEqDistance = -1 ) const; protected: /** diff --git a/src/HYDRO_tests/reference_data/Channel.png b/src/HYDRO_tests/reference_data/Channel.png new file mode 100644 index 0000000000000000000000000000000000000000..60f17399794bf5ae05996d27c59576b7883f1121 GIT binary patch literal 9131 zcmcI~i9gg`^#2{i)EEXaLKvnEp~avSW^9wk@(3X@F)g;Tq$0~a8j}_brG!G+4Oy#6 zF(n~HDtq=wiWX!Ezx&~NzTe+J@SWGo%jaY6J@0L53wn4AhaZ5%K91~i!+`tv#IxE*SH+9~NOOK;7I1diiTBt)&I9fZ&dAHLvgn1L0ry)ZWOhrBaNYh9G6ajgFTid(UOGGC zibes({G0s`%k~8a{+{R#SeOxgn*E5~v3R z#0XHHr*2R{*vASNI}ZvI`FbcLdamVBPr-V!cmQI#visV@wPC%N5Pf-V!zg;bjjR$A zKJSd_ib`GZ7$rl5obG;$S?+*)z73j+EXqp}^r@^}r*Ig-NxLJpR`GB`7Y)f}j z3whs*Hz6W|<$8RrHtv6zCs)4{4~_BeiU0k5hh{r6u~47Nj}F18ic@_{&o7ebZv%Ut zT({VH0q_Gx@3+O}pBit&zUG}FnoGcGLqYU_XH?Ro(;pq(w#Vl95?8Et?Zjl36S}ih z#0LUQ`Su!Hjw?B_5kZ^sssH#Br&Xi|4TT@gPWNH+Y;d`_Rh4}?&t*S*`qZ@&h;LaC zWpPZG9)@tCjetO=nVwF`k7U1G@ylR_MJboP&r1^l-@eDI)VTobxQ9tZ=%6$FHQK)% z7q1h)1^~P05^CXka=eUB6vC)j8J~;Z>hxxr6yd~riZ9PsZ|v;A317QC6LW*?qkKs z061Ll)UF&M&v2e2uvLpYSdVOEZ3wGC=O2AO{^(z8@NP);eYRgmphlC7Ag9s}Z6b01 zXWmAYa&EzUmMxla84{6Ed84~y-M?mOxg4L|2a?9nM5On#N3`?)2cU6asbN7IOKl@r9P#<|nQ~o8s5Ax9ggrsZBG=swM6$v9 zx1X}gTAj@@2c}m1*zhHIS046XreMB=DXTEQI$nZ~;*sr(*Zw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