1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 
4 /*
5     Rosegarden
6     A sequencer and musical notation editor.
7     Copyright 2000-2021 the Rosegarden development team.
8     See the AUTHORS file for more details.
9 
10     This program is free software; you can redistribute it and/or
11     modify it under the terms of the GNU General Public License as
12     published by the Free Software Foundation; either version 2 of the
13     License, or (at your option) any later version.  See the file
14     COPYING included with this distribution for more information.
15 */
16 
17 #ifndef RG_EQUATION_H
18 #define RG_EQUATION_H
19 
20 namespace Rosegarden {
21 
22 /**
23  * Equation solving helper class
24  */
25 class Equation
26 {
27 public:
28     enum Unknown { Y, M, X, C };
29 
30     struct Point {
PointPoint31         Point(int xx, int yy) : x(xx), y(yy) { }
32         int x;
33         int y;
34     };
35 
36     static void solve(Unknown u, double &y, double &m, double &x, double &c);
37     static void solve(Unknown u, int &y, double &m, int &x, int &c);
38 
39     static void solveForYByEndPoints(Point a, Point b, double x, double &y);
40     static void solveForYByEndPoints(Point a, Point b, int x, int &y);
41 };
42 
43 }
44 
45 #endif
46