Code

update to latest 2geom. (eol-style fix)
[inkscape.git] / src / 2geom / region.cpp
1 #include "region.h"
2 #include "utils.h"
4 #include "shape.h"
6 namespace Geom {
8 Region 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 }
14 bool Region::invariants() const {
15     return self_crossings(boundary).empty();
16 }
18 unsigned 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 }
34 }
36 /*
37   Local Variables:
38   mode:c++
39   c-file-style:"stroustrup"
40   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
41   indent-tabs-mode:nil
42   fill-column:99
43   End:
44 */
45 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :