/*********************************************************************/ /* */ /* Copyright 2022-2023 RĂ©mi Synave - remi.synave@univ-littoral.fr */ /* */ /* This file is part of DSL. */ /* This software uses Qt to build the Graphical User Interface */ /* https://www.qt.io/ */ /* */ /* DSL is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published */ /* by the Free Software Foundation, either version 3 of the License, */ /* or (at your option) any later version. */ /* */ /* DSL 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 General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with DSL. If not, see . */ /* */ /*********************************************************************/ #ifndef STRENGTHLINE_HPP #define STRENGTHLINE_HPP #include #include #include #include class StrengthLine { private: QPoint *p1 = NULL, *p2 = NULL; std::pair < float, float > equation () const; public: StrengthLine (double ax = 0.0, double ay = 0.0, double bx = 1.0, double by = 1.0); StrengthLine (QPoint * p1 = new QPoint (0, 0), QPoint * p2 = new QPoint (1, 1)); QPoint* getP1() const; QPoint* getP2() const; std::pair < QPoint *, QPoint * > toDraw (QImage * img) const; std::pair < QPoint *, QPoint * > toDraw (int imgWidth, int imgHeight) const; std::pair < QPoint *, QPoint * > interpolateToEdge (QImage * img) const; std::pair < QPoint *, QPoint * > interpolateToEdge (int imgWidth, int imgHeight) const; float ea_score(const StrengthLine *sl, double imgWidth, double imgHeight) const; float distance(const StrengthLine *sl, double imgWidth, double imgHeight) const; static StrengthLine* getRandomLine (QImage * img); static StrengthLine* getRandomLine (int width, int height); friend std::ostream& operator<<(std::ostream&, const StrengthLine); }; #endif