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 : // predeclaration
29 : class B3DHomMatrix;
30 :
31 : /** Base Point class with three double values
32 :
33 : This class derives all operators and common handling for
34 : a 3D data class from B3DTuple. All necessary extensions
35 : which are special for points will be added here.
36 :
37 : @see B3DTuple
38 : */
39 467378 : class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DPoint : public ::basegfx::B3DTuple
40 : {
41 : public:
42 : /** Create a 3D Point
43 :
44 : The point is initialized to (0.0, 0.0, 0.0)
45 : */
46 95513 : B3DPoint()
47 95513 : : B3DTuple()
48 95513 : {}
49 :
50 : /** Create a 3D Point
51 :
52 : @param fX
53 : This parameter is used to initialize the X-coordinate
54 : of the 3D Point.
55 :
56 : @param fY
57 : This parameter is used to initialize the Y-coordinate
58 : of the 3D Point.
59 :
60 : @param fZ
61 : This parameter is used to initialize the Z-coordinate
62 : of the 3D Point.
63 : */
64 326720 : B3DPoint(double fX, double fY, double fZ)
65 326720 : : B3DTuple(fX, fY, fZ)
66 326720 : {}
67 :
68 : /** Create a copy of a 3D Point
69 :
70 : @param rVec
71 : The 3D Point which will be copied.
72 : */
73 3285958 : B3DPoint(const B3DPoint& rVec)
74 3285958 : : B3DTuple(rVec)
75 3285958 : {}
76 :
77 : /** constructor with tuple to allow copy-constructing
78 : from B3DTuple-based classes
79 : */
80 0 : B3DPoint(const ::basegfx::B3DTuple& rTuple)
81 0 : : B3DTuple(rTuple)
82 0 : {}
83 :
84 3708123 : ~B3DPoint()
85 3708123 : {}
86 :
87 : /** *=operator to allow usage from B3DPoint, too
88 : */
89 : B3DPoint& operator*=( const B3DPoint& rPnt )
90 : {
91 : mfX *= rPnt.mfX;
92 : mfY *= rPnt.mfY;
93 : mfZ *= rPnt.mfZ;
94 : return *this;
95 : }
96 :
97 : /** *=operator to allow usage from B3DPoint, too
98 : */
99 : B3DPoint& operator*=(double t)
100 : {
101 : mfX *= t;
102 : mfY *= t;
103 : mfZ *= t;
104 : return *this;
105 : }
106 :
107 : /** assignment operator to allow assigning the results
108 : of B3DTuple calculations
109 : */
110 1459 : B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
111 : {
112 1459 : mfX = rVec.getX();
113 1459 : mfY = rVec.getY();
114 1459 : mfZ = rVec.getZ();
115 1459 : return *this;
116 : }
117 :
118 : /** Transform point by given transformation matrix.
119 :
120 : The translational components of the matrix are, in
121 : contrast to B3DVector, applied.
122 : */
123 : B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
124 :
125 : static const B3DPoint& getEmptyPoint()
126 : {
127 : return static_cast<const B3DPoint&>( ::basegfx::B3DTuple::getEmptyTuple() );
128 : }
129 : };
130 :
131 : // external operators
132 :
133 :
134 : /** Transform B3DPoint by given transformation matrix.
135 :
136 : Since this is a Point, translational components of the
137 : matrix are used.
138 : */
139 : BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
140 :
141 : } // end of namespace basegfx
142 :
143 : #endif // INCLUDED_BASEGFX_POINT_B3DPOINT_HXX
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|