1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASEGFX_RANGE_B3DRANGE_HXX
21 #define INCLUDED_BASEGFX_RANGE_B3DRANGE_HXX
23 #include <basegfx/vector/b3dvector.hxx>
24 #include <basegfx/point/b3dpoint.hxx>
25 #include <basegfx/tuple/b3dtuple.hxx>
26 #include <basegfx/range/basicrange.hxx>
27 #include <basegfx/basegfxdllapi.h>
33 class SAL_WARN_UNUSED B3DRange
35 typedef ::basegfx::BasicRange
< double, DoubleTraits
> MyBasicRange
;
37 MyBasicRange maRangeX
;
38 MyBasicRange maRangeY
;
39 MyBasicRange maRangeZ
;
44 explicit B3DRange(const B3DTuple
& rTuple
)
45 : maRangeX(rTuple
.getX()),
46 maRangeY(rTuple
.getY()),
47 maRangeZ(rTuple
.getZ())
66 B3DRange(const B3DTuple
& rTuple1
,
67 const B3DTuple
& rTuple2
)
68 : maRangeX(rTuple1
.getX()),
69 maRangeY(rTuple1
.getY()),
70 maRangeZ(rTuple1
.getZ())
91 bool operator==( const B3DRange
& rRange
) const
93 return (maRangeX
== rRange
.maRangeX
94 && maRangeY
== rRange
.maRangeY
95 && maRangeZ
== rRange
.maRangeZ
);
98 bool operator!=( const B3DRange
& rRange
) const
100 return (maRangeX
!= rRange
.maRangeX
101 || maRangeY
!= rRange
.maRangeY
102 || maRangeZ
!= rRange
.maRangeZ
);
105 double getMinX() const
107 return maRangeX
.getMinimum();
110 double getMinY() const
112 return maRangeY
.getMinimum();
115 double getMinZ() const
117 return maRangeZ
.getMinimum();
120 double getMaxX() const
122 return maRangeX
.getMaximum();
125 double getMaxY() const
127 return maRangeY
.getMaximum();
130 double getMaxZ() const
132 return maRangeZ
.getMaximum();
135 double getWidth() const
137 return maRangeX
.getRange();
140 double getHeight() const
142 return maRangeY
.getRange();
145 double getDepth() const
147 return maRangeZ
.getRange();
150 B3DVector
getRange() const
159 B3DPoint
getCenter() const
162 maRangeX
.getCenter(),
163 maRangeY
.getCenter(),
168 bool overlaps(const B3DRange
& rRange
) const
171 maRangeX
.overlaps(rRange
.maRangeX
)
172 && maRangeY
.overlaps(rRange
.maRangeY
)
173 && maRangeZ
.overlaps(rRange
.maRangeZ
)
177 void expand(const B3DTuple
& rTuple
)
179 maRangeX
.expand(rTuple
.getX());
180 maRangeY
.expand(rTuple
.getY());
181 maRangeZ
.expand(rTuple
.getZ());
184 void expand(const B3DRange
& rRange
)
186 maRangeX
.expand(rRange
.maRangeX
);
187 maRangeY
.expand(rRange
.maRangeY
);
188 maRangeZ
.expand(rRange
.maRangeZ
);
191 void grow(double fValue
)
193 maRangeX
.grow(fValue
);
194 maRangeY
.grow(fValue
);
195 maRangeZ
.grow(fValue
);
198 BASEGFX_DLLPUBLIC
void transform(const B3DHomMatrix
& rMatrix
);
201 } // end of namespace basegfx
204 #endif // INCLUDED_BASEGFX_RANGE_B3DRANGE_HXX
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */