Salome HOME
lot 13 -- asymmetric digue
authorisn <isn@opencascade.com>
Thu, 13 Dec 2018 11:33:19 +0000 (14:33 +0300)
committerisn <isn@opencascade.com>
Wed, 19 Dec 2018 15:21:15 +0000 (18:21 +0300)
Signed-off-by: isn <isn@opencascade.com>
src/HYDROData/HYDROData_ChannelAltitude.cxx

index b848733c96076a02c67aeefc8b82a78905586d60..3714ac6d7eb6b2ceb7f6b6593b612e81cfa6ddbb 100644 (file)
@@ -116,6 +116,10 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
 
   // --- See GEOMImpl_ProjectionDriver.cxx
 
+  gp_XY LP, RP;
+  aProfile->GetLeftPoint(LP);
+  aProfile->GetRightPoint(RP);
+
   TopoDS_Shape aShape =  aGuideXY->GetShape();
   gp_Pnt P1(thePoint.X(), thePoint.Y(), 0);
   TopoDS_Shape aPoint = BRepBuilderAPI_MakeVertex(P1).Shape();
@@ -276,6 +280,14 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
           double distance = aProjXY.Modulus();
           //DEBTRACE("distance to guideline " << distance);
 
+          gp_Vec2d aProjDir = aProjXY; 
+          gp_Vec2d aProfileDir(LP, RP);
+          double aSign = 1.0;
+          if( aProfileDir.Dot(aProjDir) < 0 )
+            aSign = -1.0;
+
+          distance *= aSign;
+
           // get delta altitude on section (supposed symmetric) from guideline distance (aParam)
           double delta = 0;
           int i1 = 0;