From dd98414d9296b30643d7be6bfc90d379227c8a68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Thu, 3 Mar 2022 13:47:18 +0100 Subject: [PATCH] Update geompp library --- debian/patches/02-geompp.patch | 148 ++++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 28 deletions(-) diff --git a/debian/patches/02-geompp.patch b/debian/patches/02-geompp.patch index 7f35295..4b5f32c 100644 --- a/debian/patches/02-geompp.patch +++ b/debian/patches/02-geompp.patch @@ -190,7 +190,7 @@ Last-Update: 2021-08-30 +#endif --- /dev/null +++ giada/src/deps/geompp/src/range.hpp -@@ -0,0 +1,61 @@ +@@ -0,0 +1,76 @@ +/* ----------------------------------------------------------------------------- + * + * geompp - Basic geometrical utilities for C++. @@ -228,8 +228,9 @@ Last-Update: 2021-08-30 +class Range +{ +public: -+ constexpr Range() -+ : Range(0, 0) ++ constexpr Range() // Invalid default range ++ : a(0) ++ , b(0) + { + } + @@ -240,8 +241,22 @@ Last-Update: 2021-08-30 + assert(a < b); + } + ++ Range operator*(const T m) const { return {a * m, b * m}; } ++ Range operator*=(const T m) const { return {a * m, b * m}; } ++ Range operator/(const T m) const { return {a / m, b / m}; } ++ Range operator/=(const T m) const { return {a / m, b / m}; } ++ Range operator+(const T m) const { return {a + m, b + m}; } ++ Range operator+=(const T m) const { return {a + m, b + m}; } ++ Range operator-(const T m) const { return {a - m, b - m}; } ++ Range operator-=(const T m) const { return {a - m, b - m}; } ++ + T getLength() const { return b - a; } + ++ bool isValid() const ++ { ++ return a < b; ++ } ++ + bool contains(T t) const + { + return t >= a && t < b; @@ -254,7 +269,7 @@ Last-Update: 2021-08-30 +#endif --- /dev/null +++ giada/src/deps/geompp/src/rect.hpp -@@ -0,0 +1,236 @@ +@@ -0,0 +1,234 @@ +/* ----------------------------------------------------------------------------- + * + * geompp - Basic geometrical utilities for C++. @@ -284,6 +299,7 @@ Last-Update: 2021-08-30 +#ifndef GEOMPP_RECT_HH +#define GEOMPP_RECT_HH + ++#include "border.hpp" +#include "line.hpp" +#include "point.hpp" +#include "range.hpp" @@ -390,29 +406,30 @@ Last-Update: 2021-08-30 + yh = y + h; + } + -+ /* reduce (1) -+ Reduces width and height by a certain amount around the center point. */ ++ /* reduce ++ Reduces all four sides by a certain Border. */ + -+ void reduce(T amountX, T amountY) ++ void reduce(Border b) + { -+ x += amountX; -+ y += amountY; -+ w -= amountX * 2; -+ h -= amountY * 2; ++ x += b.left; ++ y += b.top; ++ w -= b.left + b.right; ++ h -= b.top + b.bottom; + xw = x + w; + yh = y + h; + } + -+ /* reduce (2) -+ Reduces all four sides by a certain amount around the center point. */ -+ -+ void reduce(T amount) { reduce(amount, amount); } -+ + /* isValid + True if this Rect has size greater than zero. */ + + bool isValid() const { return w > 0 && h > 0; } + ++ /* expand (1), (2) ++ The opposite of reduce (1), (2). */ ++ ++ void expand(T amountX, T amountY) { reduce(-amountX, -amountY); } ++ void expand(T amount) { reduce(-amount); } ++ + /* with[...] + Returns a copy of this Rect with a new position/size. */ + @@ -449,25 +466,21 @@ Last-Update: 2021-08-30 + + Point getPosition() const { return Point(x, y); } + -+ /* reduced (1) -+ Returns a copy of this Rect with width and height reduced by a certain -+ amount. */ ++ /* reduced ++ Returns a copy of this Rect with all four sides reduced by a certain Border. */ + -+ Rect reduced(T amountX, T amountY) const ++ Rect reduced(Border b) const + { + Rect r = *this; -+ r.reduce(amountX, amountY); ++ r.reduce(b); + return r; + } + -+ /* reduced (2) -+ Returns a copy of this Rect with all four sides reduced by a certain amount -+ around the center point. */ ++ /* expanded (1), (2) ++ The opposite of reduced (1), (2). */ + -+ Rect reduced(T amount) const -+ { -+ return reduced(amount, amount); -+ } ++ Rect expanded(T amountX, T amountY) const { return reduced(-amountX, -amountY); } ++ Rect expanded(T amount) const { return reduced(-amount); } + + /* contains (1) + Returns true if Point p is inside this Rect. */ @@ -492,3 +505,82 @@ Last-Update: 2021-08-30 + +#endif \ No newline at end of file +--- /dev/null ++++ giada/src/deps/geompp/src/border.hpp +@@ -0,0 +1,75 @@ ++/* ----------------------------------------------------------------------------- ++ * ++ * geompp - Basic geometrical utilities for C++. ++ * ++ * ----------------------------------------------------------------------------- ++ * ++ * Copyright (C) 2021 Giovanni A. Zuliani | Monocasual Laboratories ++ * ++ * This file is part of geompp - Basic geometrical utilities for C++. ++ * ++ * geompp - Basic geometrical utilities for C++ 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. ++ * ++ * geompp - Basic geometrical utilities for C++ 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 geompp - Basic geometrical utilities for C++. If not, see ++ * . ++ * ++ * -------------------------------------------------------------------------- */ ++ ++#ifndef GEOMPP_BORDER_HH ++#define GEOMPP_BORDER_HH ++ ++namespace geompp ++{ ++template ++class Border ++{ ++public: ++ /* Border (1) ++ Empty border. */ ++ ++ constexpr Border() ++ : Border(0, 0, 0, 0) ++ { ++ } ++ ++ /* Border (2) ++ Normal border. */ ++ ++ constexpr Border(T t, T r, T b, T l) ++ : top(t) ++ , right(r) ++ , bottom(b) ++ , left(l) ++ { ++ } ++ ++ /* Border (3) ++ Normal border, all sides equal. */ ++ ++ constexpr Border(T v) ++ : Border(v, v, v, v) ++ { ++ } ++ ++ /* Border (4) ++ Normal border, horizontal and vertical sides equal. */ ++ ++ constexpr Border(T x, T y) ++ : Border(y, x, y, x) ++ { ++ } ++ ++ T top, right, bottom, left; ++}; ++} // namespace geompp ++ ++#endif +\ No newline at end of file -- 2.30.2