X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Curve.cpp;h=f96fd7b7850d7d4492dbbbf4419a85064ce66621;hb=592f9b635dddfc888cc2e14d8e996e0e21d904b3;hp=d6a7280c644b74eaf3aac23f0303925558300cfb;hpb=4783f146b71a48c651523fcf0e12367bcf3d1fa8;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index d6a7280c6..f96fd7b78 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,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) { } @@ -25,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)); } @@ -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())); +}