Index: src/Shapes/BaseShapes.cpp
===================================================================
--- src/Shapes/BaseShapes.cpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/BaseShapes.cpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -12,4 +12,9 @@
 #include "vector.hpp"
 #include "Helpers/Assert.hpp"
+
+#include "Line.hpp"
+#include "Plane.hpp"
+#include "LineSegment.hpp"
+#include "LineSegmentSet.hpp"
 
 #include <cmath>
@@ -29,4 +34,13 @@
   }
   return point;
+}
+
+LineSegmentSet Sphere_impl::getLineIntersections(const Line &line){
+  LineSegmentSet res(line);
+  std::vector<Vector> intersections = line.getSphereIntersections();
+  if(intersections.size()==2){
+    res.insert(LineSegment(intersections[0],intersections[1]));
+  }
+  return res;
 }
 
@@ -81,4 +95,34 @@
 }
 
+LineSegmentSet Cuboid_impl::getLineIntersections(const Line &line){
+  LineSegmentSet res(line);
+  // get the intersection on each of the six faces
+  vector<Vector> intersections;
+  intersections.resize(2);
+  int c=0;
+  int x[2]={-1,+1};
+  for(int i=NDIM;i--;){
+    for(int p=0;p<2;++p){
+      if(c==2) goto end; // I know this sucks, but breaking two loops is stupid
+      Vector base;
+      base[i]=x[p];
+      // base now points to the surface and is normal to it at the same time
+      Plane p(base,base);
+      Vector intersection = p.GetIntersection(line);
+      if(isInside(intersection)){
+        // if we have a point on the edge it might already be contained
+        if(c==1 && intersections[0]==intersection)
+          continue;
+        intersections[c++]=intersection;
+      }
+    }
+  }
+  end:
+  if(c==2){
+    res.insert(LineSegment(intersections[0],intersections[1]));
+  }
+  return res;
+}
+
 string Cuboid_impl::toString(){
   return "Cuboid()";
Index: src/Shapes/BaseShapes_impl.hpp
===================================================================
--- src/Shapes/BaseShapes_impl.hpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/BaseShapes_impl.hpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -15,4 +15,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
   virtual std::string toString();
 };
@@ -22,4 +23,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
   virtual std::string toString();
 };
Index: src/Shapes/Shape.cpp
===================================================================
--- src/Shapes/Shape.cpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/Shape.cpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -31,4 +31,8 @@
 Vector Shape::getNormal(const Vector &point) const throw (NotOnSurfaceException){
   return impl->getNormal(point);
+}
+
+LineSegmentSet Shape::getLineIntersections(const Line &line){
+  return impl->getLineIntersections(line);
 }
 
@@ -126,4 +130,8 @@
 }
 
+LineSegmentSet AndShape_impl::getLineIntersections(const Line &line){
+  return intersect(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
+}
+
 string AndShape_impl::toString(){
   return string("(") + lhs->toString() + string("&&") + rhs->toString() + string(")");
@@ -190,4 +198,8 @@
 }
 
+LineSegmentSet OrShape_impl::getLineIntersections(const Line &line){
+  return merge(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
+}
+
 string OrShape_impl::toString(){
   return string("(") + lhs->toString() + string("||") + rhs->toString() + string(")");
@@ -217,4 +229,8 @@
 Vector NotShape_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
   return -1*arg->getNormal(point);
+}
+
+LineSegmentSet NotShape_impl::getLineIntersections(const Line &line){
+  return invert(arg->getLineIntersections(line));
 }
 
Index: src/Shapes/Shape.hpp
===================================================================
--- src/Shapes/Shape.hpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/Shape.hpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -16,4 +16,6 @@
 class Vector;
 class Shape_impl;
+class LineSegmentSet;
+class Line;
 
 class Shape
@@ -30,4 +32,6 @@
   bool isOnSurface(const Vector &point) const;
   Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
+
+  LineSegmentSet getLineIntersections(const Line&);
 
   Shape &operator=(const Shape& rhs);
Index: src/Shapes/ShapeOps.cpp
===================================================================
--- src/Shapes/ShapeOps.cpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/ShapeOps.cpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -32,4 +32,23 @@
   }
   return translateOutNormal(arg->getNormal(helper));
+}
+
+LineSegmentSet ShapeOpsBase_impl::getLineIntersections(const Line &line){
+  Line newLine(translateIn(line.getOrigin()),translateIn(line.getDirection()));
+  LineSegmentSet res(line);
+  LineSegmentSet helper = getArg()->getLineIntersections(newLine);
+  for(LineSegmentSet::iterator iter = helper.begin();iter!=helper.end();++iter){
+    LinePoint lpBegin = iter->getBegin();
+    LinePoint lpEnd = iter->getBegin();
+    // translate both linepoints
+    lpBegin = lpBegin.isNegInfinity()?
+                line.negEndpoint():
+                line.getLinePoint(translateOutPos(lpBegin.getPoint()));
+    lpEnd = lpEnd.isPosInfinity()?
+              line.posEndpoint():
+              line.getLinePoint(translateOutPos(lpEnd.getPoint()));
+    res.insert(LineSegment(lpBegin,lpEnd));
+  }
+  return res;
 }
 
Index: src/Shapes/ShapeOps_impl.hpp
===================================================================
--- src/Shapes/ShapeOps_impl.hpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/ShapeOps_impl.hpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -20,4 +20,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw (NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
 protected:
   virtual Vector translateIn(const Vector &point)=0;
Index: src/Shapes/Shape_impl.hpp
===================================================================
--- src/Shapes/Shape_impl.hpp	(revision 40196a0aea164ac0333f8918bdc9b72e107db6a3)
+++ src/Shapes/Shape_impl.hpp	(revision c6f3950823f0d994bbcf963786243385a0ef3a90)
@@ -11,4 +11,8 @@
 #include "Shapes/Shape.hpp"
 #include "vector.hpp"
+#include "Line.hpp"
+#include "LineSegment.hpp"
+#include "LineSegmentSet.hpp"
+
 
 class Shape_impl {
@@ -19,4 +23,5 @@
   virtual bool isOnSurface(const Vector &point)=0;
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException)=0;
+  virtual LineSegmentSet getLineIntersections(const Line&)=0;
   virtual std::string toString()=0;
 };
@@ -32,4 +37,9 @@
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException){
     throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  virtual LineSegmentSet getLineIntersections(const Line &line){
+    LineSegmentSet res(line);
+    res.insert(LineSegment(line.negEndpoint(),line.posEndpoint()));
+    return res;
   }
   virtual std::string toString(){
@@ -48,4 +58,7 @@
     throw NotOnSurfaceException(__FILE__,__LINE__);
   }
+  virtual LineSegmentSet getLineIntersections(const Line &line){
+    return LineSegmentSet(line);
+  }
   virtual std::string toString(){
     return "Nowhere()";
@@ -60,4 +73,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
   virtual std::string toString();
 private:
@@ -73,4 +87,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
   virtual std::string toString();
 private:
@@ -86,4 +101,5 @@
   virtual bool isOnSurface(const Vector &point);
   virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
   virtual std::string toString();
 private:
