]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2656: angle is shown differntly in viewer and in property panel
authorazv <azv@opencascade.com>
Mon, 1 Oct 2018 11:01:03 +0000 (14:01 +0300)
committerazv <azv@opencascade.com>
Mon, 1 Oct 2018 11:12:02 +0000 (14:12 +0300)
src/FeaturesPlugin/Test/TestMeasurementAngle.py
src/GeomAPI/GeomAPI_Angle.cpp

index b3033467da28140abc54d6a3d790a71631228fe2..bec25e1c22ec4a1e544afc74a0a15edb51fb6a5c 100644 (file)
@@ -73,13 +73,13 @@ TOLERANCE = 1.e-6
 
 # reference data
 REF_DATA = [("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchLine_6", [90]),
-            ("Extrusion_1_1/Generated_Face_5", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [135]),
-            ("Sketch_1/Edge-SketchCircle_1_2", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [180]),
+            ("Extrusion_1_1/Generated_Face_5", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [45]),
+            ("Sketch_1/Edge-SketchCircle_1_2", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [0]),
             ("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchCircle_1_2", []),
             ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", []),
             ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_4", [130]),
-            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_1", [140]),
-            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [58.78794626, 95.19768874])
+            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_1", [40]),
+            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [121.21205374, 84.80231126])
            ]
 
 for ref in REF_DATA:
index 220141523e52ea07c71701e418dbc84375cbd89d..ca1c06275c8d94d8281dcde566b2302787cbe6dc 100644 (file)
@@ -58,12 +58,18 @@ GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Edge>& theEdge1,
   gp_Pnt aP;
 
   GeomAPI_ProjectPointOnCurve aProj1(aPoint, aCurve1);
-  if (aProj1.NbPoints() > 0)
+  if (aProj1.NbPoints() > 0) {
     aCurve1->D1(aProj1.LowerDistanceParameter(), aP, anAngle->myDir1);
+    if (aCurve1->Value(aF1).SquareDistance(aPoint) < aCurve1->Value(aL1).SquareDistance(aPoint))
+      anAngle->myDir1.Reverse();
+  }
 
   GeomAPI_ProjectPointOnCurve aProj2(aPoint, aCurve2);
-  if (aProj2.NbPoints() > 0)
+  if (aProj2.NbPoints() > 0) {
     aCurve2->D1(aProj2.LowerDistanceParameter(), aP, anAngle->myDir2);
+    if (aCurve2->Value(aF2).SquareDistance(aPoint) < aCurve2->Value(aL2).SquareDistance(aPoint))
+      anAngle->myDir2.Reverse();
+  }
 
   setImpl(anAngle);
 }