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 Coverage combine_coverage(Coverage a, Coverage b) { return std::max(a, b); }
14 static bool shortcircuit(bool c) { return c; }
18 Joins component shapes together into one.
20 template<typename T, unsigned D>
21 class Union: public CompositeShape<T, D, UnionOps<T, D> >
26 Union(const Shape<T, D> &, const Shape<T, D> &);
28 template<typename Iter>
29 static Union from_iterator_range(const Iter &, const Iter &);
31 virtual Union *clone() const;
34 template<typename T, unsigned D>
35 inline Union<T, D>::Union(const Shape<T, D> &s1, const Shape<T, D> &s2):
36 CompositeShape<T, D, UnionOps<T, D> >(s1, s2)
39 template<typename T, unsigned D>
40 template<typename Iter>
41 inline Union<T, D> Union<T, D>::from_iterator_range(const Iter &begin, const Iter &end)
44 shape.init_from_iter_range(begin, end);
48 template<typename T, unsigned D>
49 inline Union<T, D> *Union<T, D>::clone() const
51 return new Union<T, D>(*this);
54 } // namespace Geometry