diff Framework/Toolbox/CoordinateSystem3D.cpp @ 647:6af3099ed8da

uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 May 2019 17:03:46 +0200
parents b70e9be013e4
children f7c236894c1a
line wrap: on
line diff
--- a/Framework/Toolbox/CoordinateSystem3D.cpp	Mon May 13 15:22:08 2019 +0200
+++ b/Framework/Toolbox/CoordinateSystem3D.cpp	Mon May 13 17:03:46 2019 +0200
@@ -187,4 +187,24 @@
   {
     return GeometryToolbox::IntersectPlaneAndLine(p, normal_, d_, origin, direction);
   }
+
+
+  bool CoordinateSystem3D::GetDistance(double& distance,
+                                       const CoordinateSystem3D& a,
+                                       const CoordinateSystem3D& b)
+  {
+    bool opposite;   // Ignored
+
+    if (OrthancStone::GeometryToolbox::IsParallelOrOpposite(
+          opposite, a.GetNormal(), b.GetNormal()))
+    {
+      distance = std::abs(a.ProjectAlongNormal(a.GetOrigin()) -
+                          a.ProjectAlongNormal(b.GetOrigin()));
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
 }