1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_Dir.cpp
4 // Created: 23 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #include <GeomAPI_Dir.h>
8 #include <GeomAPI_XYZ.h>
12 #define MY_DIR implPtr<gp_Dir>()
14 GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, const double theZ)
15 : GeomAPI_Interface(new gp_Dir(theX, theY, theZ))
19 GeomAPI_Dir::GeomAPI_Dir(const std::shared_ptr<GeomAPI_XYZ>& theCoords)
20 : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
24 double GeomAPI_Dir::x() const
29 double GeomAPI_Dir::y() const
34 double GeomAPI_Dir::z() const
39 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
41 return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
44 void GeomAPI_Dir::reverse()
49 double GeomAPI_Dir::dot(const std::shared_ptr<GeomAPI_Dir>& theArg) const
51 return MY_DIR->Dot(theArg->impl<gp_Dir>());
54 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
55 const std::shared_ptr<GeomAPI_Dir>& theArg) const
57 gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl<gp_Dir>().XYZ());
58 return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
61 double GeomAPI_Dir::angle(const std::shared_ptr<GeomAPI_Dir>& theArg) const
63 return MY_DIR->Angle(theArg->impl<gp_Dir>());
66 bool GeomAPI_Dir::isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
67 const double theTolerance) const
69 return MY_DIR->IsParallel(theDir->impl<gp_Dir>(), theTolerance) == Standard_True;