code format

This commit is contained in:
2022-12-14 14:13:52 +03:00
parent 430a41fefc
commit c2b8a8d6da
297 changed files with 27331 additions and 24162 deletions

View File

@@ -3,24 +3,24 @@
* \brief
* \~english Two-dimensional line class
* \~russian Класс отрезка двумерной линии
*/
*/
/*
PIP - Platform Independent Primitives
Two-dimensional line class
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
PIP - Platform Independent Primitives
Two-dimensional line class
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PILINE_H
#define PILINE_H
@@ -38,13 +38,14 @@
template<typename Type>
class PIP_EXPORT PILine {
static_assert(std::is_arithmetic<Type>::value, "Type must be arithmetic");
public:
PIPoint<Type> p0;
PIPoint<Type> p1;
//! \~russian
//! Пустой конструктор.
//! \details
//! \details
//! При выполнении пустого конструктора координаты не изменяются.
//! Начало и конец совпадают.
PILine() {}
@@ -81,17 +82,15 @@ public:
//! \~russian
//! Проверить на совпадение координат начала и конца.
bool isEmpty() const {
return (p0 == p1);
}
bool isEmpty() const { return (p0 == p1); }
//! \~russian
//! Вычислить ширину прямоугольника, диагональю которого является данный отрезок.
Type width() const {return piAbs<Type>(p1.x - p0.x);}
Type width() const { return piAbs<Type>(p1.x - p0.x); }
//! \~russian
//! Вычислить высоту прямоугольника, диагональю которого является данный отрезок.
Type height() const {return piAbs<Type>(p1.y - p0.y);}
Type height() const { return piAbs<Type>(p1.y - p0.y); }
//! \~russian
//! Сдвинуть линию на \a x, \a y.
@@ -127,12 +126,12 @@ public:
//! \~russian
//! Сдвинуть линию на \a x, \a y.
//! \details Является копией метода \a translate().
PILine<Type> & move(Type x, Type y) {return translate(x, y);}
PILine<Type> & move(Type x, Type y) { return translate(x, y); }
//! \~russian
//! Сдвинуть линию на значение координат точки \a PIPoint.
//! \details Является копией метода \a translate().
PILine<Type> & move(const PIPoint<Type> & p) {return translate(p);}
PILine<Type> & move(const PIPoint<Type> & p) { return translate(p); }
//! \~russian
//! Создать копию отрезка и сдвинуть её на \a x, \a y.
@@ -142,7 +141,7 @@ public:
l.translate(x, y);
return l;
}
//! \~russian
//! Создать копию отрезка и сдвинуть её на значение координат точки \a PIPoint.
//! \details Является копией метода \a translated().
@@ -153,33 +152,33 @@ public:
}
//! \~russian Сдвинуть линию по двум координатам на значение \a x.
void operator +=(Type x) {translate(x, x);}
void operator+=(Type x) { translate(x, x); }
//! \~russian Сдвинуть линию по двум координатам на величину координат точки \a PIPoint.
void operator +=(const PIPoint<Type> & p) {translate(p);}
void operator+=(const PIPoint<Type> & p) { translate(p); }
//! \~russian Сдвинуть линию по двум координатам на значение \a x.
void operator -=(Type x) {translate(-x, -x);}
void operator-=(Type x) { translate(-x, -x); }
//! \~russian Сдвинуть линию по двум координатам на величину координат точки \a PIPoint.
void operator -=(const PIPoint<Type> & p) {translate(-p);}
void operator-=(const PIPoint<Type> & p) { translate(-p); }
//! \~russian Сдвинуть линию по двум координатам на величину координат точки \a PIPoint.
PILine<Type> operator +(const PIPoint<Type> & p) {return translated(p);}
PILine<Type> operator+(const PIPoint<Type> & p) { return translated(p); }
//! \~russian Сдвинуть линию по двум координатам на величину координат точки \a PIPoint.
PILine<Type> operator -(const PIPoint<Type> & p) {return translated(-p);}
PILine<Type> operator-(const PIPoint<Type> & p) { return translated(-p); }
//! \~russian Проверить равенство координат двух отрезков.
bool operator ==(const PILine<Type> & r) const {return (p0 == r.p0 && p1 == r.p1);}
bool operator==(const PILine<Type> & r) const { return (p0 == r.p0 && p1 == r.p1); }
//! \~russian Проверить неравенство координат двух отрезков.
bool operator !=(const PILine<Type> & r) const {return (p1 != r.p1 || p1 != r.p1);}
bool operator!=(const PILine<Type> & r) const { return (p1 != r.p1 || p1 != r.p1); }
};
//! \~russian Перегруженный оператор для вывода координат в \a PICout.
template<typename Type>
PICout operator <<(PICout & s, const PILine<Type> & v) {
PICout operator<<(PICout & s, const PILine<Type> & v) {
s.saveAndSetControls(0);
s << "Line{" << v.p0 << ", " << v.p1 << "}";
s.restoreControls();