Salome HOME
Reverted some changes in salome build/run scripts.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Angle.cpp
index 97d45ee3ec22f1fd73495f1e8335711432964c6b..220141523e52ea07c71701e418dbc84375cbd89d 100644 (file)
@@ -59,15 +59,29 @@ GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Edge>& theEdge1,
 
   GeomAPI_ProjectPointOnCurve aProj1(aPoint, aCurve1);
   if (aProj1.NbPoints() > 0)
-    aCurve1->D1(aProj1.Parameter(1), aP, anAngle->myDir1);
+    aCurve1->D1(aProj1.LowerDistanceParameter(), aP, anAngle->myDir1);
 
   GeomAPI_ProjectPointOnCurve aProj2(aPoint, aCurve2);
   if (aProj2.NbPoints() > 0)
-    aCurve2->D1(aProj2.Parameter(1), aP, anAngle->myDir2);
+    aCurve2->D1(aProj2.LowerDistanceParameter(), aP, anAngle->myDir2);
 
   setImpl(anAngle);
 }
 
+GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Pnt>& thePoint1,
+                             const std::shared_ptr<GeomAPI_Pnt>& thePoint2,
+                             const std::shared_ptr<GeomAPI_Pnt>& thePoint3)
+{
+  gp_Pnt aPoint1 = thePoint1->impl<gp_Pnt>();
+  gp_Pnt aPoint2 = thePoint2->impl<gp_Pnt>();
+  gp_Pnt aPoint3 = thePoint3->impl<gp_Pnt>();
+
+  AngleDirections* anAngle = new AngleDirections;
+  anAngle->myDir1.SetXYZ(aPoint1.XYZ() - aPoint2.XYZ());
+  anAngle->myDir2.SetXYZ(aPoint3.XYZ() - aPoint2.XYZ());
+  setImpl(anAngle);
+}
+
 double GeomAPI_Angle::angleDegree()
 {
   return angleRadian() * 180.0 / PI;