1 // File: GeomAPI_Pnt2d.cpp
2 // Created: 29 May 2014
3 // Author: Artem ZHIDKOV
5 #include<GeomAPI_Pnt2d.h>
7 #include<GeomAPI_XYZ.h>
8 #include<GeomAPI_Pnt.h>
9 #include<GeomAPI_Dir.h>
11 #include<gp_Pnt2d.hxx>
13 #define MY_PNT2D static_cast<gp_Pnt2d*>(myImpl)
15 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY)
16 : GeomAPI_Interface(new gp_Pnt2d(theX, theY))
20 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
21 : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
25 double GeomAPI_Pnt2d::x() const
30 double GeomAPI_Pnt2d::y() const
35 void GeomAPI_Pnt2d::setX(const double theX)
37 return MY_PNT2D->SetX(theX);
40 void GeomAPI_Pnt2d::setY(const double theY)
42 return MY_PNT2D->SetY(theY);
45 boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
46 const boost::shared_ptr<GeomAPI_Dir>& theDirX,
47 const boost::shared_ptr<GeomAPI_Dir>& theDirY)
49 boost::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
50 ->added(theDirY->xyz()->multiplied(y()));
52 return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
55 const boost::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
57 return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
60 double GeomAPI_Pnt2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
62 return MY_PNT2D->Distance(theOther->impl<gp_Pnt2d>());