LibreOffice Module basegfx (master) 1
b3drange.cxx
Go to the documentation of this file.
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
22
23namespace basegfx
24{
25 void B3DRange::transform(const B3DHomMatrix& rMatrix)
26 {
27 if(isEmpty() || rMatrix.isIdentity())
28 return;
29
30 const B3DRange aSource(*this);
31 reset();
32 expand(rMatrix * B3DPoint(aSource.getMinX(), aSource.getMinY(), aSource.getMinZ()));
33 expand(rMatrix * B3DPoint(aSource.getMaxX(), aSource.getMinY(), aSource.getMinZ()));
34 expand(rMatrix * B3DPoint(aSource.getMinX(), aSource.getMaxY(), aSource.getMinZ()));
35 expand(rMatrix * B3DPoint(aSource.getMaxX(), aSource.getMaxY(), aSource.getMinZ()));
36 expand(rMatrix * B3DPoint(aSource.getMinX(), aSource.getMinY(), aSource.getMaxZ()));
37 expand(rMatrix * B3DPoint(aSource.getMaxX(), aSource.getMinY(), aSource.getMaxZ()));
38 expand(rMatrix * B3DPoint(aSource.getMinX(), aSource.getMaxY(), aSource.getMaxZ()));
39 expand(rMatrix * B3DPoint(aSource.getMaxX(), aSource.getMaxY(), aSource.getMaxZ()));
40 }
41
42 B3DRange& B3DRange::operator*=( const ::basegfx::B3DHomMatrix& rMat )
43 {
44 transform(rMat);
45 return *this;
46 }
47
49 {
50 static const B3DRange aUnitB3DRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
51
52 return aUnitB3DRange;
53 }
54
55 B3DRange operator*( const ::basegfx::B3DHomMatrix& rMat, const B3DRange& rB3DRange )
56 {
57 B3DRange aRes( rB3DRange );
58 aRes *= rMat;
59 return aRes;
60 }
61
62} // end of namespace basegfx
63
64/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isIdentity() const
Base Point class with three double values.
Definition: b3dpoint.hxx:38
double getMinZ() const
Definition: b3drange.hxx:114
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix &rMatrix)
Definition: b3drange.cxx:25
double getMaxZ() const
Definition: b3drange.hxx:129
double getMinX() const
Definition: b3drange.hxx:104
bool isEmpty() const
Definition: b3drange.hxx:74
void expand(const B3DTuple &rTuple)
Definition: b3drange.hxx:176
B3DRange & operator*=(const ::basegfx::B3DHomMatrix &rMat)
Transform Range by given transformation matrix.
Definition: b3drange.cxx:42
static const B3DRange & getUnitB3DRange()
Get a range filled with (0.0, 0.0, 0.0, 1.0, 1.0, 1.0)
Definition: b3drange.cxx:48
double getMinY() const
Definition: b3drange.hxx:109
double getMaxX() const
Definition: b3drange.hxx:119
double getMaxY() const
Definition: b3drange.hxx:124
B2DPoint operator*(const ::basegfx::B2DHomMatrix &rMat, const B2DPoint &rPoint)
Definition: b2dpoint.cxx:43