1 #ifndef __2GEOM_SHAPE_H
2 #define __2GEOM_SHAPE_H
22 BOOLOP_INTERSECT = BOOLOP_BOTH,
23 BOOLOP_SUBTRACT_A_B = BOOLOP_JUST_B,
24 BOOLOP_IDENTITY_A = BOOLOP_JUST_A | BOOLOP_BOTH,
25 BOOLOP_SUBTRACT_B_A = BOOLOP_JUST_A,
26 BOOLOP_IDENTITY_B = BOOLOP_JUST_B | BOOLOP_BOTH,
27 BOOLOP_EXCLUSION = BOOLOP_JUST_A | BOOLOP_JUST_B,
28 BOOLOP_UNION = BOOLOP_JUST_A | BOOLOP_JUST_B | BOOLOP_BOTH
35 friend CrossingSet crossings_between(
Shape const &a,
Shape const &b);
36 friend Shape shape_boolean(
bool rev,
Shape const &,
Shape const &, CrossingSet
const &);
38 friend Shape boolop(
Shape const &a,
Shape const &b,
unsigned, CrossingSet
const &);
39 friend void add_to_shape(
Shape &s,
Path const &p,
bool);
41 Shape() : fill(
true) {}
43 content = Regions(1, r);
46 explicit Shape(Regions
const & r) : content(r) { update_fill(); }
47 explicit Shape(
bool f) : fill(f) {}
48 Shape(Regions
const & r,
bool f) : content(r), fill(f) {}
50 Regions getContent()
const {
return content; }
51 bool isFill()
const {
return fill; }
53 unsigned size()
const {
return content.size(); }
54 const Region &operator[](
unsigned ix)
const {
return content[ix]; }
56 Shape inverse()
const;
59 bool contains(
Point const &p)
const;
61 bool inside_invariants()
const;
62 bool region_invariants()
const;
63 bool cross_invariants()
const;
64 bool invariants()
const;
67 std::vector<unsigned> containment_list(
Point p)
const;
68 void update_fill()
const {
69 unsigned ix = outer_index(content);
71 fill = content[ix].fill;
73 fill = content.front().fill;
79 inline CrossingSet crossings_between(
Shape const &a,
Shape const &b) {
return crossings(paths_from_regions(a.content), paths_from_regions(b.content)); }
81 Shape shape_boolean(
bool rev, Shape
const &, Shape
const &, CrossingSet
const &);
82 Shape shape_boolean(
bool rev, Shape
const &, Shape
const &);
86 void crossing_dual(
unsigned &i,
unsigned &j, CrossingSet
const & crs);
87 unsigned crossing_along(
double t,
unsigned ix,
unsigned jx,
bool dir, Crossings
const & crs);
89 Shape boolop(Shape
const &, Shape
const &,
unsigned flags);
90 Shape boolop(Shape
const &, Shape
const &,
unsigned flags, CrossingSet &);
92 Shape sanitize(std::vector<Path>
const &ps);
94 Shape stopgap_cleaner(std::vector<Path>
const &ps);
96 inline std::vector<Path> desanitize(Shape
const & s) {
97 return paths_from_regions(s.getContent());
Cartesian point.
Definition: point.h:20