1 #ifndef MSP_GEOMETRY_UNION_H_
2 #define MSP_GEOMETRY_UNION_H_
4 #include "compositeshape.h"
9 template<typename T, unsigned D>
12 static BoundingBox<T, D> combine_aabb(const BoundingBox<T, D> &a, const BoundingBox<T, D> &b) { return a|b; }
13 static bool init_inside() { return false; }
14 static bool combine_inside(bool a, bool b) { return a || b; }
15 static bool is_inside_decided(bool a) { return a; }
16 static bool init_surface() { return true; }
17 static bool combine_surface(bool a, bool b) { return a && !b; }
21 Joins component shapes together into one.
23 template<typename T, unsigned D>
24 class Union: public CompositeShape<T, D, UnionOps<T, D> >
29 Union(const Shape<T, D> &, const Shape<T, D> &);
31 template<typename Iter>
32 static Union from_iterator_range(const Iter &, const Iter &);
34 virtual Union *clone() const;
37 template<typename T, unsigned D>
38 inline Union<T, D>::Union(const Shape<T, D> &s1, const Shape<T, D> &s2):
39 CompositeShape<T, D, UnionOps<T, D> >(s1, s2)
42 template<typename T, unsigned D>
43 template<typename Iter>
44 inline Union<T, D> Union<T, D>::from_iterator_range(const Iter &begin, const Iter &end)
47 shape.init_from_iter_range(begin, end);
51 template<typename T, unsigned D>
52 inline Union<T, D> *Union<T, D>::clone() const
54 return new Union<T, D>(*this);
57 } // namespace Geometry