X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Curve.cpp;h=46a1ea19f663732398053c879e03682ce95514e7;hb=aa48919bb1ecb71f07d9ac5fcd1bad170e7ed547;hp=53a84581054f743f48e1bb1dafadb93e72b5fde6;hpb=a970d71a76da019f965cd16a346737dc4cd9b634;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index 53a845810..46a1ea19f 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -1,8 +1,11 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_Curve.cpp // Created: 04 Sep 2014 // Author: Mikhail PONIKAROV #include +#include #include #include @@ -11,22 +14,22 @@ #include #include #include +#include #define MY_CURVE (*(static_cast(myImpl))) GeomAPI_Curve::GeomAPI_Curve() - : GeomAPI_Interface(new Handle_Geom_Curve()) + : GeomAPI_Interface(new Handle_Geom_Curve()), myStart(0), myEnd(1) { } -GeomAPI_Curve::GeomAPI_Curve(const boost::shared_ptr& theShape) +GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& theShape) : GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null { const TopoDS_Shape& aShape = theShape->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { - Standard_Real aStart, anEnd; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aStart, anEnd); + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd); if (!aCurve.IsNull()) { setImpl(new Handle(Geom_Curve)(aCurve)); } @@ -47,3 +50,10 @@ bool GeomAPI_Curve::isCircle() const { return !isNull() && MY_CURVE->DynamicType() == STANDARD_TYPE(Geom_Circle); } + +std::shared_ptr GeomAPI_Curve::getPoint(double theParam) +{ + GeomAdaptor_Curve aAdaptor(MY_CURVE, myStart, myEnd); + gp_Pnt aPnt = aAdaptor.Value(theParam); + return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); +}