1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_XYZ.cpp
4 // Created: 23 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #include<GeomAPI_XYZ.h>
11 #define MY_XYZ static_cast<gp_XYZ*>(myImpl)
13 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
14 : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
18 double GeomAPI_XYZ::x() const
23 double GeomAPI_XYZ::y() const
28 double GeomAPI_XYZ::z() const
33 void GeomAPI_XYZ::setX(const double theX)
35 return MY_XYZ->SetX(theX);
38 void GeomAPI_XYZ::setY(const double theY)
40 return MY_XYZ->SetY(theY);
43 void GeomAPI_XYZ::setZ(const double theZ)
45 return MY_XYZ->SetZ(theZ);
48 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
49 const std::shared_ptr<GeomAPI_XYZ>& theArg)
51 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
52 MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
56 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
57 const std::shared_ptr<GeomAPI_XYZ>& theArg)
59 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
60 MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
64 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
66 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
67 MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
71 double GeomAPI_XYZ::dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const
73 return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
76 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
77 const std::shared_ptr<GeomAPI_XYZ>& theArg) const
79 gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
80 return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
83 double GeomAPI_XYZ::distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const
85 gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
86 return aResult.Modulus();