shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@7294 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h
index 84c3b66..afdb8e9 100644
--- a/experimental/Intersection/DataTypes.h
+++ b/experimental/Intersection/DataTypes.h
@@ -135,11 +135,26 @@
return v;
}
+ void operator+=(const _Point& v) {
+ x += v.x;
+ y += v.y;
+ }
+
void operator-=(const _Point& v) {
x -= v.x;
y -= v.y;
}
+ void operator/=(const double s) {
+ x /= s;
+ y /= s;
+ }
+
+ void operator*=(const double s) {
+ x *= s;
+ y *= s;
+ }
+
friend bool operator==(const _Point& a, const _Point& b) {
return a.x == b.x && a.y == b.y;
}
@@ -187,11 +202,19 @@
}
// FIXME: used by debugging only ?
- bool contains(const _Point& pt) {
+ bool contains(const _Point& pt) const {
return approximately_between(left, pt.x, right)
&& approximately_between(top, pt.y, bottom);
}
+ bool intersects(_Rect& r) const {
+ assert(left < right);
+ assert(top < bottom);
+ assert(r.left < r.right);
+ assert(r.top < r.bottom);
+ return r.left < right && left < r.right && r.top < bottom && top < r.bottom;
+ }
+
void set(const _Point& pt) {
left = right = pt.x;
top = bottom = pt.y;