From 424707ff4e1adb83401e51dd77816c6634dc81e7 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Mon, 6 Aug 2018 13:59:12 +0200
Subject: [PATCH] geometry example usage

---
 Main/geometry_example.cc | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Main/geometry_example.cc

diff --git a/Main/geometry_example.cc b/Main/geometry_example.cc
new file mode 100644
index 00000000..8c057ed5
--- /dev/null
+++ b/Main/geometry_example.cc
@@ -0,0 +1,40 @@
+/*
+  from within ngc/build/ directory:
+  g++ -O3 -I ../third_party/ -I<path to eigen> -I ../ -Wall -pedantic \
+   -std=c++14 ../Main/geometry_example.cc \
+   ../Framework/Geometry/CoordinateSystem.cc -o geometry_example
+*/
+#include <Framework/Geometry/Vector.h>
+#include <Framework/Geometry/Sphere.h>
+#include <Framework/Geometry/Point.h>
+#include <Framework/Geometry/CoordinateSystem.h>
+#include <phys/units/quantity.hpp>
+#include <phys/units/io.hpp>
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+    using namespace phys::units;
+    using namespace phys::units::io;
+    using namespace phys::units::literals;
+    
+    CoordinateSystem root;
+    Point const p1(root, {0_m, 0_m, 0_m});
+    CoordinateSystem cs2 = root.translate({0_m, 0_m, 1_m});
+    Point const p2(cs2, {0_m, 0_m, 0_m});
+    
+    auto const diff = p2 - p1;
+    auto const norm = diff.squaredNorm();
+    
+    std::cout << diff.getComponents() << std::endl;
+    std::cout << norm << std::endl;
+    
+    Sphere s(p1, 10_m);
+    std::cout << s.isInside(p2) << std::endl;    
+    
+    Sphere s2(p1, 3_um);
+    std::cout << s2.isInside(p2) << std::endl;    
+    
+    return EXIT_SUCCESS;
+}
-- 
GitLab