]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/intersection.h
Implement bounding boxes with a separate class
[libs/math.git] / source / geometry / intersection.h
index c20aae126d1b021552d430df5fc05a5c1a8ad205..01707cdfc64274a79317179fc3faa96348c3c591 100644 (file)
@@ -12,7 +12,7 @@ Forms a shape from the common parts of component shapes.
 template<typename T, unsigned D>
 struct IntersectionOps
 {
-       static HyperBox<T, D> combine_aabb(const HyperBox<T, D> &, const HyperBox<T, D> &);
+       static BoundingBox<T, D> combine_aabb(const BoundingBox<T, D> &a, const BoundingBox<T, D> &b) { return a&b; }
        static bool init_inside() { return true; }
        static bool combine_inside(bool a, bool b) { return a && b; }
        static bool is_inside_decided(bool a) { return !a; }
@@ -54,16 +54,6 @@ inline Intersection<T, D> *Intersection<T, D>::clone() const
        return new Intersection<T, D>(*this);
 }
 
-
-template<typename T, unsigned D>
-inline HyperBox<T, D> IntersectionOps<T, D>::combine_aabb(const HyperBox<T, D> &box1, const HyperBox<T, D> &box2)
-{
-       LinAl::Vector<T, D> dimensions;
-       for(unsigned i=0; i<D; ++i)
-               dimensions[i] = std::min(box1.get_dimension(i), box2.get_dimension(i));
-       return HyperBox<T, D>(dimensions);
-}
-
 } // namespace Geometry
 } // namespace Msp