Tue, 14 Feb 2017 08:08:17 +0200
Moved camera names to GLCamera, other adjustments
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QVector> |
733
cc39df788660
- reimplemented the Vertex class as a derivative of QVector3D
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
21 | #include <functional> |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "main.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "basics.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | class LDDocument; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | class QColor; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | class QAction; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
733
cc39df788660
- reimplemented the Vertex class as a derivative of QVector3D
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
29 | using ApplyToMatrixFunction = std::function<void (int, double&)>; |
cc39df788660
- reimplemented the Vertex class as a derivative of QVector3D
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
30 | using ApplyToMatrixConstFunction = std::function<void (int, double)>; |
cc39df788660
- reimplemented the Vertex class as a derivative of QVector3D
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
31 | |
1013
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
32 | void applyToMatrix (Matrix& a, ApplyToMatrixFunction func); |
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
33 | void applyToMatrix (const Matrix& a, ApplyToMatrixConstFunction func); |
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
34 | QString formatFileSize (qint64 size); |
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
35 | int gcd (int a, int b); |
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
36 | QString joinStrings (QList<StringFormatArg> vals, QString delim = " "); |
1066
d7ec12688716
Refactor roundToDecimals and formatFileSize
Teemu Piippo <teemu@hecknology.net>
parents:
1024
diff
changeset
|
37 | void roundToDecimals (double& value, int decimals); |
1013
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
38 | void simplify (int& numer, int& denom); |
1088
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
39 | |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
40 | /* |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
41 | * Rounds the input value to the nearest multiple of the provided interval. |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
42 | */ |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
43 | template<typename T> |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
44 | T roundToInterval(T value, double interval) |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
45 | { |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
46 | return static_cast<T>(round(value / interval) * interval); |
c6d242d2b619
Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents:
1072
diff
changeset
|
47 | } |