]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Ability to change direction of the Angle presentation (issue #882)
authorazv <azv@opencascade.com>
Fri, 11 Sep 2015 12:45:03 +0000 (15:45 +0300)
committerazv <azv@opencascade.com>
Fri, 11 Sep 2015 12:45:59 +0000 (15:45 +0300)
src/SketcherPrs/SketcherPrs_Angle.cpp

index 40133d9cb8124f1c7ce76cea27fd39cb68cf60df..1e35ac4701f089c30dd7a1496e5eb70186596f93 100644 (file)
@@ -82,10 +82,15 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP
   TopoDS_Edge aEdge2 = TopoDS::Edge(aTEdge2);
   SetMeasuredGeometry(aEdge1, aEdge2);
 
-  gp_Pnt aCenter = CenterPoint();
+  const gp_Pnt& aCenter = CenterPoint();
+  const gp_Pnt& aFirst = FirstPoint();
+  const gp_Pnt& aSecond = SecondPoint();
 
-  gp_Pnt aFLyPnt(aFlyoutPnt->x(), aFlyoutPnt->y(), aFlyoutPnt->z());
-  double aDist = aCenter.Distance(aFLyPnt);
+  gp_Dir aBisector((aFirst.XYZ() + aSecond.XYZ()) * 0.5 - aCenter.XYZ());
+
+  gp_Pnt aFlyPnt(aFlyoutPnt->x(), aFlyoutPnt->y(), aFlyoutPnt->z());
+  gp_XYZ aFlyDir = aFlyPnt.XYZ() - aCenter.XYZ();
+  double aDist = aFlyDir.Dot(aBisector.XYZ());
   SetFlyout(aDist);
 
   // Angle value is in degrees