+ Geom2dAdaptor_Curve anAdaptor( theHydraulicAxis );
+ TopoDS_Edge E2d = BRepLib_MakeEdge2d(theHydraulicAxis).Edge();
+ GCPnts_AbscissaPoint ap( anAdaptor, theMidCurve.Xcurv(), anAdaptor.FirstParameter() );
+ double aParam = ap.Parameter();
+
+ gp_Pnt2d point;
+ anAdaptor.D0( aParam, point );
+ gp_Vec2d profile_dir = theMidCurve.ProfileDir();
+ gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz );
+ profile_dir.Normalize();
+
+ size_t n = theMidCurve.size();
+ double min_param = 1E+15;
+ double max_param = -1E+15;
+ double z1, z2;
+ for( size_t i=0; i<n; i++ )
+ {
+ double param1 = theMidCurve[i].U - theWidthCurve[i].U / 2;
+ double param2 = theMidCurve[i].U + theWidthCurve[i].U / 2;
+
+ gp_Pnt2d p1 = point.Translated( param1 * profile_dir);
+ gp_Pnt2d p2 = point.Translated( param2 * profile_dir);
+
+ double z = theMidCurve[i].Z;
+
+ if( param1 < min_param )
+ {
+ min_param = param1;
+ z1 = z;
+ }
+ if( param2 < min_param )
+ {
+ min_param = param2;
+ z1 = z;
+ }
+ if( param1 > max_param )
+ {
+ max_param = param1;
+ z2 = z;
+ }
+ if( param2 > max_param )
+ {
+ max_param = param2;
+ z2 = z;
+ }
+
+ AltitudePoint p3d_1( p1.X(), p1.Y(), z ), p3d_2( p2.X(), p2.Y(), z );
+ thePoints.push_back( p3d_1 );
+ thePoints.push_back( p3d_2 );
+ }
+
+ if( theLeft )
+ {
+ gp_Pnt2d left2d = point.Translated( min_param * profile_dir );
+ gp_Pnt left( left2d.X(), left2d.Y(), z1 );
+ theLeft->push_back( left, tangent_n );
+ }
+ if( theRight )
+ {
+ gp_Pnt2d right2d = point.Translated( max_param * profile_dir );
+ gp_Pnt right( right2d.X(), right2d.Y(), z2 );
+ theRight->push_back( right, tangent_n );
+ }