more ai generated doc with human review
This commit is contained in:
@@ -40,12 +40,15 @@ public:
|
||||
Type x;
|
||||
Type y;
|
||||
|
||||
//! \~english Creates a new point.
|
||||
//! \~russian Создает новую точку.
|
||||
PIPoint() { x = y = Type(); }
|
||||
|
||||
//! \~english Creates a new point with given coordinates.
|
||||
//! \~russian Создает новую точку с заданными координатами.
|
||||
PIPoint(Type x_, Type y_) { set(x_, y_); }
|
||||
|
||||
//! \~english Set new coordinates for the point.
|
||||
//! \~russian Задать новые координаты точке.
|
||||
PIPoint<Type> & set(Type x_, Type y_) {
|
||||
x = x_;
|
||||
@@ -53,6 +56,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Set new coordinates from another point.
|
||||
//! \~russian Задать новые координаты точке.
|
||||
PIPoint<Type> & set(const PIPoint<Type> & p) {
|
||||
x = p.x;
|
||||
@@ -60,6 +64,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Translate the point by x and y.
|
||||
//! \~russian Переместить точку.
|
||||
PIPoint<Type> & translate(Type x_, Type y_) {
|
||||
x += x_;
|
||||
@@ -67,6 +72,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Translate the point by another point.
|
||||
//! \~russian Переместить точку.
|
||||
PIPoint<Type> & translate(const PIPoint<Type> & p) {
|
||||
x += p.x;
|
||||
@@ -74,6 +80,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Create a copy of the point and translate it.
|
||||
//! \~russian Создать копию точки и переместить её.
|
||||
PIPoint<Type> translated(Type x_, Type y_) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
@@ -81,6 +88,7 @@ public:
|
||||
return rp;
|
||||
}
|
||||
|
||||
//! \~english Create a copy of the point and translate it by another point.
|
||||
//! \~russian Создать копию точки и переместить её.
|
||||
PIPoint<Type> translated(const PIPoint<Type> & p) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
@@ -88,14 +96,17 @@ public:
|
||||
return rp;
|
||||
}
|
||||
|
||||
//! \~english Translate the point. Alias for \a translate().
|
||||
//! \~russian Переместить точку.
|
||||
//! \details Является копией метода \a translate().
|
||||
PIPoint<Type> & move(Type x_, Type y_) { return translate(x_, y_); }
|
||||
|
||||
//! \~english Translate the point by another point. Alias for \a translate().
|
||||
//! \~russian Переместить точку.
|
||||
//! \details Является копией метода \a translate().
|
||||
PIPoint<Type> & move(const PIPoint<Type> & p) { return translate(p); }
|
||||
|
||||
//! \~english Create a copy of the point and translate it. Alias for \a translated().
|
||||
//! \~russian Создать копию точки и переместить её.
|
||||
//! \details Является копией метода \a translated().
|
||||
PIPoint<Type> moved(Type x_, Type y_) const {
|
||||
@@ -104,6 +115,7 @@ public:
|
||||
return rp;
|
||||
}
|
||||
|
||||
//! \~english Create a copy of the point and translate it by another point. Alias for \a translated().
|
||||
//! \~russian Создать копию точки и переместить её.
|
||||
//! \details Является копией метода \a translated().
|
||||
PIPoint<Type> moved(const PIPoint<Type> & p) const {
|
||||
@@ -112,65 +124,82 @@ public:
|
||||
return rp;
|
||||
}
|
||||
|
||||
//! \~english Calculate angle in radians in polar coordinate system.
|
||||
//! \~russian Посчитать угол(радианы) в поолярной системе координат.
|
||||
double angleRad() const { return atan2(y, x); }
|
||||
|
||||
//! \~english Calculate angle in degrees in polar coordinate system.
|
||||
//! \~russian Посчитать угол(градусы) в поолярной системе координат.
|
||||
double angleDeg() const { return toDeg(atan2(y, x)); }
|
||||
|
||||
//! \~english Convert copy of point to polar coordinate system.
|
||||
//! \~russian Перевести копию точки в полярную систему координат.
|
||||
PIPoint<Type> toPolar(bool isDeg = false) const { return PIPoint<Type>(sqrt(x * x + y * y), isDeg ? angleDeg() : angleRad()); }
|
||||
|
||||
//! \~english Convert point from polar to cartesian coordinate system.
|
||||
//! \~russian Перевести копию точки из полярной системы координат в декартовую.
|
||||
static PIPoint<Type> fromPolar(const PIPoint<Type> & p) { return PIPoint<Type>(p.y * cos(p.x), p.y * sin(p.x)); }
|
||||
|
||||
//! \~russian
|
||||
//! Прибавить координаты второй точки и сохранить.
|
||||
//! \~english Add second point coordinates and save.
|
||||
//! \~russian Прибавить координаты второй точки и сохранить.
|
||||
//! \details Является копией метода \a translate().
|
||||
PIPoint<Type> & operator+=(const PIPoint<Type> & p) {
|
||||
translate(p);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Multiply coordinates by value.
|
||||
PIPoint<Type> & operator*=(Type v) {
|
||||
x *= v;
|
||||
y *= v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Divide coordinates by value.
|
||||
PIPoint<Type> & operator/=(Type v) {
|
||||
x /= v;
|
||||
y /= v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Add coordinates of two points.
|
||||
//! \~russian Сложить координаты двух точек.
|
||||
PIPoint<Type> operator+(const PIPoint<Type> & p) { return PIPoint<Type>(x + p.x, y + p.y); }
|
||||
|
||||
//! \~english Add value to both coordinates.
|
||||
//! \~russian Прибавить к координатам одинаковое значение.
|
||||
PIPoint<Type> operator+(const Type & p) { return PIPoint<Type>(x + p, y + p); }
|
||||
|
||||
//! \~english Subtract second point coordinates - get offset.
|
||||
//! \~russian Вычесть из координат координаты второй точки - найти смещение.
|
||||
PIPoint<Type> operator-(const PIPoint<Type> & p) { return PIPoint<Type>(x - p.x, y - p.y); }
|
||||
|
||||
//! \~english Subtract value from both coordinates.
|
||||
//! \~russian Вычесть из координат одинаковое значение.
|
||||
PIPoint<Type> operator-(const Type & p) { return PIPoint<Type>(x - p, y - p); }
|
||||
|
||||
//! \~english Invert point coordinates.
|
||||
//! \~russian Инвертировать координаты точки.
|
||||
PIPoint<Type> operator-() { return PIPoint<Type>(-x, -y); }
|
||||
|
||||
//! \~english Multiply point coordinates.
|
||||
//! \~russian Умножить координаты точки.
|
||||
PIPoint<Type> operator*(Type v) { return PIPoint<Type>(x * v, y * v); }
|
||||
|
||||
//! \~english Divide point coordinates.
|
||||
//! \~russian Делить координаты точки.
|
||||
PIPoint<Type> operator/(Type v) { return PIPoint<Type>(x / v, y / v); }
|
||||
|
||||
//! \~english Check equality of two points.
|
||||
//! \~russian Проверить равенство координат двух точек.
|
||||
bool operator==(const PIPoint<Type> & p) const { return (x == p.x && y == p.y); }
|
||||
|
||||
//! \~english Check inequality of two points.
|
||||
//! \~russian Проверить неравенство координат двух точек.
|
||||
bool operator!=(const PIPoint<Type> & p) const { return (x != p.x || y != p.y); }
|
||||
};
|
||||
|
||||
//! \~english Stream output operator for PIPoint.
|
||||
//! \~russian Перегруженный оператор для вывода координат в \a PICout.
|
||||
template<typename Type>
|
||||
PICout operator<<(PICout & s, const PIPoint<Type> & v) {
|
||||
|
||||
Reference in New Issue
Block a user