Line data Source code
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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_BASEGFX_POINT_B3DPOINT_HXX
21 : #define INCLUDED_BASEGFX_POINT_B3DPOINT_HXX
22 :
23 : #include <basegfx/tuple/b3dtuple.hxx>
24 : #include <basegfx/basegfxdllapi.h>
25 :
26 : namespace basegfx
27 : {
28 : class B3DHomMatrix;
29 :
30 : /** Base Point class with three double values
31 :
32 : This class derives all operators and common handling for
33 : a 3D data class from B3DTuple. All necessary extensions
34 : which are special for points will be added here.
35 :
36 : @see B3DTuple
37 : */
38 271331 : class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DPoint : public ::basegfx::B3DTuple
39 : {
40 : public:
41 : /** Create a 3D Point
42 :
43 : The point is initialized to (0.0, 0.0, 0.0)
44 : */
45 64743 : B3DPoint()
46 64743 : : B3DTuple()
47 64743 : {}
48 :
49 : /** Create a 3D Point
50 :
51 : @param fX
52 : This parameter is used to initialize the X-coordinate
53 : of the 3D Point.
54 :
55 : @param fY
56 : This parameter is used to initialize the Y-coordinate
57 : of the 3D Point.
58 :
59 : @param fZ
60 : This parameter is used to initialize the Z-coordinate
61 : of the 3D Point.
62 : */
63 327585 : B3DPoint(double fX, double fY, double fZ)
64 327585 : : B3DTuple(fX, fY, fZ)
65 327585 : {}
66 :
67 : /** Create a copy of a 3D Point
68 :
69 : @param rVec
70 : The 3D Point which will be copied.
71 : */
72 2205654 : B3DPoint(const B3DPoint& rVec)
73 2205654 : : B3DTuple(rVec)
74 2205654 : {}
75 :
76 : /** constructor with tuple to allow copy-constructing
77 : from B3DTuple-based classes
78 : */
79 0 : B3DPoint(const ::basegfx::B3DTuple& rTuple)
80 0 : : B3DTuple(rTuple)
81 0 : {}
82 :
83 2597936 : ~B3DPoint()
84 2597936 : {}
85 :
86 : /** *=operator to allow usage from B3DPoint, too
87 : */
88 : B3DPoint& operator*=( const B3DPoint& rPnt )
89 : {
90 : mfX *= rPnt.mfX;
91 : mfY *= rPnt.mfY;
92 : mfZ *= rPnt.mfZ;
93 : return *this;
94 : }
95 :
96 : /** *=operator to allow usage from B3DPoint, too
97 : */
98 : B3DPoint& operator*=(double t)
99 : {
100 : mfX *= t;
101 : mfY *= t;
102 : mfZ *= t;
103 : return *this;
104 : }
105 :
106 : /** assignment operator to allow assigning the results
107 : of B3DTuple calculations
108 : */
109 1366 : B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
110 : {
111 1366 : mfX = rVec.getX();
112 1366 : mfY = rVec.getY();
113 1366 : mfZ = rVec.getZ();
114 1366 : return *this;
115 : }
116 :
117 : /** Transform point by given transformation matrix.
118 :
119 : The translational components of the matrix are, in
120 : contrast to B3DVector, applied.
121 : */
122 : B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
123 :
124 : static const B3DPoint& getEmptyPoint()
125 : {
126 : return static_cast<const B3DPoint&>( ::basegfx::B3DTuple::getEmptyTuple() );
127 : }
128 : };
129 :
130 : // external operators
131 :
132 :
133 : /** Transform B3DPoint by given transformation matrix.
134 :
135 : Since this is a Point, translational components of the
136 : matrix are used.
137 : */
138 : BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
139 :
140 : } // end of namespace basegfx
141 :
142 : #endif // INCLUDED_BASEGFX_POINT_B3DPOINT_HXX
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|