tdf#161411 - UI: Add Better wording for ASCII-only characters
[LibreOffice.git] / include / basegfx / tuple / Tuple3D.hxx
blob0b528c8341749fb0c1e0ec97d8e95f3d2092c9b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 */
11 #pragma once
13 namespace basegfx
15 template <typename TYPE> class Tuple3D
17 protected:
18 TYPE mnX;
19 TYPE mnY;
20 TYPE mnZ;
22 public:
23 /** Create a 3D Tuple
25 @param x
26 This parameter is used to initialize the X-coordinate
27 of the 3D Tuple.
29 @param y
30 This parameter is used to initialize the Y-coordinate
31 of the 3D Tuple.
33 @param z
34 This parameter is used to initialize the Z-coordinate
35 of the 3D Tuple.
37 Tuple3D(TYPE x, TYPE y, TYPE z)
38 : mnX(x)
39 , mnY(y)
40 , mnZ(z)
44 /// Get X-Coordinate of 3D Tuple
45 TYPE getX() const { return mnX; }
47 /// Get Y-Coordinate of 3D Tuple
48 TYPE getY() const { return mnY; }
50 /// Get Z-Coordinate of 3D Tuple
51 TYPE getZ() const { return mnZ; }
53 /// Set X-Coordinate of 3D Tuple
54 void setX(TYPE fX) { mnX = fX; }
56 /// Set Y-Coordinate of 3D Tuple
57 void setY(TYPE fY) { mnY = fY; }
59 /// Set Z-Coordinate of 3D Tuple
60 void setZ(TYPE fZ) { mnZ = fZ; }
62 // operators
64 Tuple3D& operator+=(const Tuple3D& rTup)
66 mnX += rTup.mnX;
67 mnY += rTup.mnY;
68 mnZ += rTup.mnZ;
69 return *this;
72 Tuple3D& operator-=(const Tuple3D& rTup)
74 mnX -= rTup.mnX;
75 mnY -= rTup.mnY;
76 mnZ -= rTup.mnZ;
77 return *this;
80 Tuple3D& operator/=(const Tuple3D& rTup)
82 mnX /= rTup.mnX;
83 mnY /= rTup.mnY;
84 mnZ /= rTup.mnZ;
85 return *this;
88 Tuple3D& operator*=(const Tuple3D& rTup)
90 mnX *= rTup.mnX;
91 mnY *= rTup.mnY;
92 mnZ *= rTup.mnZ;
93 return *this;
96 Tuple3D& operator*=(TYPE t)
98 mnX *= t;
99 mnY *= t;
100 mnZ *= t;
101 return *this;
104 Tuple3D& operator/=(TYPE t)
106 mnX /= t;
107 mnY /= t;
108 mnZ /= t;
109 return *this;
112 bool operator==(const Tuple3D& rTup) const
114 return mnX == rTup.mnX && mnY == rTup.mnY && mnZ == rTup.mnZ;
117 bool operator!=(const Tuple3D& rTup) const { return !operator==(rTup); }
120 } // end of namespace basegfx
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */