R2Vector operator/(const R2Vector& vector, double a) { assert(a != 0); return R2Vector(vector.X() / a, vector.Y() / a); }
void R3Matrix:: Scale(const R2Vector& scale) { // Scale matrix XScale(scale.X()); YScale(scale.Y()); }
void R3Matrix:: Translate(const R2Vector& offset) { // Translate matrix XTranslate(offset.X()); YTranslate(offset.Y()); }
R2Vector operator*(const R3Matrix& a, const R2Vector& v) { // Multiply matrix by vector RNCoord x = a.m[0][0] * v.X() + a.m[0][1] * v.Y(); RNCoord y = a.m[1][0] * v.X() + a.m[1][1] * v.Y(); return R2Vector(x, y); }
R2Point operator-(const R2Point& point, const R2Vector& vector) { return R2Point(point.X() - vector.X(), point.Y() - vector.Y()); }
R2Halfspace:: R2Halfspace(const R2Point& point, const R2Vector& normal) : line(point, R2Vector(-normal.Y(), normal.X())) { }
double operator%(const R2Vector& vector1, const R2Vector& vector2) { // Return cross product return vector1.X()*vector2.Y() - vector1.Y()*vector2.X(); }
R2Vector operator*(const R2Vector& vector, double a) { return R2Vector(vector.X() * a, vector.Y() * a); }
R2Vector operator-(const R2Vector& vector) { return R2Vector(-vector.X(), -vector.Y()); }