X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Curve.cpp;h=f96fd7b7850d7d4492dbbbf4419a85064ce66621;hb=592f9b635dddfc888cc2e14d8e996e0e21d904b3;hp=9b4f4e26d8e8869945df7aa7a5b24ef34bb93ff5;hpb=3874b57fe5aba25ff5aee2a07654fc23c1ee8eb0;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index 9b4f4e26d..f96fd7b78 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -5,6 +5,7 @@ // Author: Mikhail PONIKAROV #include +#include #include #include @@ -13,11 +14,12 @@ #include #include #include +#include -#define MY_CURVE (*(static_cast(myImpl))) +#define MY_CURVE (*(implPtr())) GeomAPI_Curve::GeomAPI_Curve() - : GeomAPI_Interface(new Handle_Geom_Curve()) + : GeomAPI_Interface(new Handle_Geom_Curve()), myStart(0), myEnd(1) { } @@ -27,8 +29,7 @@ GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& theShape) 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)); } @@ -49,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())); +}