1 /* { dg-do compile } */
5 VectorD2() : x(0), y(0) { }
6 VectorD2(int _x, int _y) : x(_x), y(_y) { }
8 int GetLength2() const { return x*x + y*y; };
9 VectorD2 operator+(const VectorD2 vec) const {
10 return VectorD2(x+vec.x,y+vec.y);
15 enum Type { ST_RECT, ST_CIRCLE } type;
18 bool CollisionWith(const Shape& s) const;
20 bool Shape::CollisionWith(const Shape& s) const
22 if(type == ST_CIRCLE && s.type == ST_RECT)
23 return s.CollisionWith(*this);
24 return (pos + s.pos).GetLength2() < (radius + s.radius).GetLength2();