/src/libreoffice/include/basegfx/tuple/Tuple3D.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | */ |
10 | | |
11 | | #pragma once |
12 | | |
13 | | namespace basegfx |
14 | | { |
15 | | template <typename TYPE> class Tuple3D |
16 | | { |
17 | | protected: |
18 | | TYPE mnX; |
19 | | TYPE mnY; |
20 | | TYPE mnZ; |
21 | | |
22 | | public: |
23 | | /** Create a 3D Tuple |
24 | | |
25 | | @param x |
26 | | This parameter is used to initialize the X-coordinate |
27 | | of the 3D Tuple. |
28 | | |
29 | | @param y |
30 | | This parameter is used to initialize the Y-coordinate |
31 | | of the 3D Tuple. |
32 | | |
33 | | @param z |
34 | | This parameter is used to initialize the Z-coordinate |
35 | | of the 3D Tuple. |
36 | | */ |
37 | | Tuple3D(TYPE x, TYPE y, TYPE z) |
38 | 1.43M | : mnX(x) |
39 | 1.43M | , mnY(y) |
40 | 1.43M | , mnZ(z) |
41 | 1.43M | { |
42 | 1.43M | } basegfx::Tuple3D<double>::Tuple3D(double, double, double) Line | Count | Source | 38 | 1.43M | : mnX(x) | 39 | 1.43M | , mnY(y) | 40 | 1.43M | , mnZ(z) | 41 | 1.43M | { | 42 | 1.43M | } |
Unexecuted instantiation: basegfx::Tuple3D<int>::Tuple3D(int, int, int) |
43 | | |
44 | | /// Get X-Coordinate of 3D Tuple |
45 | 489k | TYPE getX() const { return mnX; }basegfx::Tuple3D<double>::getX() const Line | Count | Source | 45 | 489k | TYPE getX() const { return mnX; } |
Unexecuted instantiation: basegfx::Tuple3D<int>::getX() const |
46 | | |
47 | | /// Get Y-Coordinate of 3D Tuple |
48 | 507k | TYPE getY() const { return mnY; }basegfx::Tuple3D<double>::getY() const Line | Count | Source | 48 | 507k | TYPE getY() const { return mnY; } |
Unexecuted instantiation: basegfx::Tuple3D<int>::getY() const |
49 | | |
50 | | /// Get Z-Coordinate of 3D Tuple |
51 | 492k | TYPE getZ() const { return mnZ; } |
52 | | |
53 | | /// Set X-Coordinate of 3D Tuple |
54 | 18.3k | void setX(TYPE fX) { mnX = fX; } |
55 | | |
56 | | /// Set Y-Coordinate of 3D Tuple |
57 | 27.4k | void setY(TYPE fY) { mnY = fY; } |
58 | | |
59 | | /// Set Z-Coordinate of 3D Tuple |
60 | 6.10k | void setZ(TYPE fZ) { mnZ = fZ; } |
61 | | |
62 | | // operators |
63 | | |
64 | | Tuple3D& operator+=(const Tuple3D& rTup) |
65 | 6.10k | { |
66 | 6.10k | mnX += rTup.mnX; |
67 | 6.10k | mnY += rTup.mnY; |
68 | 6.10k | mnZ += rTup.mnZ; |
69 | 6.10k | return *this; |
70 | 6.10k | } |
71 | | |
72 | | Tuple3D& operator-=(const Tuple3D& rTup) |
73 | 30.5k | { |
74 | 30.5k | mnX -= rTup.mnX; |
75 | 30.5k | mnY -= rTup.mnY; |
76 | 30.5k | mnZ -= rTup.mnZ; |
77 | 30.5k | return *this; |
78 | 30.5k | } |
79 | | |
80 | | Tuple3D& operator/=(const Tuple3D& rTup) |
81 | | { |
82 | | mnX /= rTup.mnX; |
83 | | mnY /= rTup.mnY; |
84 | | mnZ /= rTup.mnZ; |
85 | | return *this; |
86 | | } |
87 | | |
88 | | Tuple3D& operator*=(const Tuple3D& rTup) |
89 | 0 | { |
90 | 0 | mnX *= rTup.mnX; |
91 | 0 | mnY *= rTup.mnY; |
92 | 0 | mnZ *= rTup.mnZ; |
93 | 0 | return *this; |
94 | 0 | } |
95 | | |
96 | | Tuple3D& operator*=(TYPE t) |
97 | 6.10k | { |
98 | 6.10k | mnX *= t; |
99 | 6.10k | mnY *= t; |
100 | 6.10k | mnZ *= t; |
101 | 6.10k | return *this; |
102 | 6.10k | } |
103 | | |
104 | | Tuple3D& operator/=(TYPE t) |
105 | 0 | { |
106 | 0 | mnX /= t; |
107 | 0 | mnY /= t; |
108 | 0 | mnZ /= t; |
109 | 0 | return *this; |
110 | 0 | } |
111 | | |
112 | | bool operator==(const Tuple3D& rTup) const |
113 | | { |
114 | | return mnX == rTup.mnX && mnY == rTup.mnY && mnZ == rTup.mnZ; |
115 | | } |
116 | | |
117 | | bool operator!=(const Tuple3D& rTup) const { return !operator==(rTup); } |
118 | | }; |
119 | | |
120 | | } // end of namespace basegfx |
121 | | |
122 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |