PIPoint operators *=, /=, * and / now also with PIPoint
This commit is contained in:
@@ -167,6 +167,22 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \~english Multiplies by-coordinates by `v`.
|
||||||
|
//! \~russian Умножает по-координатно на `v`.
|
||||||
|
PIPoint<Type> & operator*=(const PIPoint<Type> & v) {
|
||||||
|
x *= v.x;
|
||||||
|
y *= v.y;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \~english Divides by-coordinates by `v`.
|
||||||
|
//! \~russian Делит по-координатно на `v`.
|
||||||
|
PIPoint<Type> & operator/=(const PIPoint<Type> & v) {
|
||||||
|
x /= v.x;
|
||||||
|
y /= v.y;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//! \~english Returns sum of two points.
|
//! \~english Returns sum of two points.
|
||||||
//! \~russian Возвращает сумму двух точек.
|
//! \~russian Возвращает сумму двух точек.
|
||||||
PIPoint<Type> operator+(const PIPoint<Type> & p) const { return PIPoint<Type>(x + p.x, y + p.y); }
|
PIPoint<Type> operator+(const PIPoint<Type> & p) const { return PIPoint<Type>(x + p.x, y + p.y); }
|
||||||
@@ -195,6 +211,14 @@ public:
|
|||||||
//! \~russian Возвращает точку, деленную на `v`.
|
//! \~russian Возвращает точку, деленную на `v`.
|
||||||
PIPoint<Type> operator/(Type v) const { return PIPoint<Type>(x / v, y / v); }
|
PIPoint<Type> operator/(Type v) const { return PIPoint<Type>(x / v, y / v); }
|
||||||
|
|
||||||
|
//! \~english Returns point multiplied by `v`.
|
||||||
|
//! \~russian Возвращает точку, умноженную на `v`.
|
||||||
|
PIPoint<Type> operator*(const PIPoint<Type> & v) const { return PIPoint<Type>(x * v.x, y * v.y); }
|
||||||
|
|
||||||
|
//! \~english Returns point divided by `v`.
|
||||||
|
//! \~russian Возвращает точку, деленную на `v`.
|
||||||
|
PIPoint<Type> operator/(const PIPoint<Type> & v) const { return PIPoint<Type>(x / v.x, y / v.y); }
|
||||||
|
|
||||||
//! \~english Checks whether point coordinates are equal.
|
//! \~english Checks whether point coordinates are equal.
|
||||||
//! \~russian Проверяет равенство координат точек.
|
//! \~russian Проверяет равенство координат точек.
|
||||||
bool operator==(const PIPoint<Type> & p) const { return (x == p.x && y == p.y); }
|
bool operator==(const PIPoint<Type> & p) const { return (x == p.x && y == p.y); }
|
||||||
|
|||||||
Reference in New Issue
Block a user