Salome HOME
Issue #251. Append Export/Import NewGeom commands in the SALOME desktop.
[modules/shaper.git] / src / GeomAPI / GeomAPI_XYZ.cpp
index 30c246323a26d18feb7e9e8b9117816852c4b5b9..37ba3aa9faa60d8d44e7237fcb3881dce33a17a8 100644 (file)
@@ -9,8 +9,9 @@
 #define MY_XYZ static_cast<gp_XYZ*>(myImpl)
 
 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
-  : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
-{}
+    : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
+{
+}
 
 double GeomAPI_XYZ::x() const
 {
@@ -43,16 +44,43 @@ void GeomAPI_XYZ::setZ(const double theZ)
 }
 
 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
-  const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg)
 {
   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
-    MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
+  MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
+  return aResult;
+}
+
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+{
+  boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
+  MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
   return aResult;
 }
 
 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
 {
   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
-    MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
+  MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
   return aResult;
 }
+
+double GeomAPI_XYZ::dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+{
+  return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
+}
+
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+{
+  gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
+  return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
+}
+
+double GeomAPI_XYZ::distance(const boost::shared_ptr<GeomAPI_XYZ>& theOther) const
+{
+  gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
+  return aResult.Modulus();
+}
+