X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Lin.cpp;h=dba5834abc1b7cb596f0cd088ddb4d954480f437;hb=3d28bcbab2f3ed0e40295e64f4e836caebc19fca;hp=770d7175f0230fc7ea6e8576836db182bb212749;hpb=4783f146b71a48c651523fcf0e12367bcf3d1fa8;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Lin.cpp b/src/GeomAPI/GeomAPI_Lin.cpp index 770d7175f..dba5834ab 100644 --- a/src/GeomAPI/GeomAPI_Lin.cpp +++ b/src/GeomAPI/GeomAPI_Lin.cpp @@ -1,9 +1,12 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_Lin.cpp // Created: 29 May 2014 // Author: Artem ZHIDKOV #include #include +#include #include #include @@ -17,7 +20,7 @@ #include #include -#define MY_LIN static_cast(myImpl) +#define MY_LIN implPtr() static gp_Lin* newLine(const double theStartX, const double theStartY, const double theStartZ, const double theEndX, const double theEndY, const double theEndZ) @@ -40,6 +43,18 @@ GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr& theStart, { } +std::shared_ptr GeomAPI_Lin::location() +{ + gp_Pnt aLoc = impl().Location(); + return std::shared_ptr(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z())); +} + +std::shared_ptr GeomAPI_Lin::direction() +{ + const gp_Dir& aDir = impl().Direction(); + return std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z())); +} + double GeomAPI_Lin::distance(const std::shared_ptr& thePoint) const { return MY_LIN->Distance(thePoint->impl()); @@ -59,10 +74,10 @@ const std::shared_ptr GeomAPI_Lin::intersect( gp_Lin2d aPrjLine1 = ProjLib::Project(aPlane, *MY_LIN); gp_Lin2d aPrjLine2 = ProjLib::Project(aPlane, theLine->impl()); - IntAna2d_AnaIntersection anInter(aPrjLine1, aPrjLine1); + IntAna2d_AnaIntersection anInter(aPrjLine1, aPrjLine2); if (!anInter.IsDone() || anInter.IsEmpty()) return std::shared_ptr(); - const gp_Pnt2d& anIntPnt2d = anInter.Point(0).Value(); + const gp_Pnt2d& anIntPnt2d = anInter.Point(1).Value(); gp_Pnt aResult = ElSLib::Value(anIntPnt2d.X(), anIntPnt2d.Y(), aPlane); return std::shared_ptr(