1 #include "region.h" 2 #include "utils.h" 3 4 #include "shape.h" 5 6 namespace Geom { 7 operator *(Matrix const & m) const8Region Region::operator*(Matrix const &m) const { 9 Region r((m.flips() ? boundary.reverse() : boundary) * m, fill); 10 if(box && m.onlyScaleAndTranslation()) r.box = (*box) * m; 11 return r; 12 } 13 invariants() const14bool Region::invariants() const { 15 return self_crossings(boundary).empty(); 16 } 17 outer_index(Regions const & ps)18unsigned outer_index(Regions const &ps) { 19 if(ps.size() <= 1 || ps[0].contains(ps[1])) { 20 return 0; 21 } else { 22 /* Since we've already shown that chunks[0] is not outside 23 it can be used as an exemplar inner. */ 24 Point exemplar = Path(ps[0]).initialPoint(); 25 for(unsigned i = 1; i < ps.size(); i++) { 26 if(ps[i].contains(exemplar)) { 27 return i; 28 } 29 } 30 } 31 return ps.size(); 32 } 33 34 } 35