Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / basegfx / source / matrix / b3dhommatrixtools.cxx
blobd6b9d32ef773f8fb55a6f9de4c352773dda0b649
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 * 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 #include <basegfx/matrix/b3dhommatrixtools.hxx>
21 #include <com/sun/star/drawing/HomogenMatrix.hpp>
23 namespace basegfx
25 namespace utils
27 B3DHomMatrix UnoHomogenMatrixToB3DHomMatrix(const com::sun::star::drawing::HomogenMatrix& rMatrixIn)
29 B3DHomMatrix aRetval;
31 aRetval.set(0, 0, rMatrixIn.Line1.Column1);
32 aRetval.set(0, 1, rMatrixIn.Line1.Column2);
33 aRetval.set(0, 2, rMatrixIn.Line1.Column3);
34 aRetval.set(0, 3, rMatrixIn.Line1.Column4);
35 aRetval.set(1, 0, rMatrixIn.Line2.Column1);
36 aRetval.set(1, 1, rMatrixIn.Line2.Column2);
37 aRetval.set(1, 2, rMatrixIn.Line2.Column3);
38 aRetval.set(1, 3, rMatrixIn.Line2.Column4);
39 aRetval.set(2, 0, rMatrixIn.Line3.Column1);
40 aRetval.set(2, 1, rMatrixIn.Line3.Column2);
41 aRetval.set(2, 2, rMatrixIn.Line3.Column3);
42 aRetval.set(2, 3, rMatrixIn.Line3.Column4);
43 aRetval.set(3, 0, rMatrixIn.Line4.Column1);
44 aRetval.set(3, 1, rMatrixIn.Line4.Column2);
45 aRetval.set(3, 2, rMatrixIn.Line4.Column3);
46 aRetval.set(3, 3, rMatrixIn.Line4.Column4);
48 return aRetval;
51 void B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn,
52 com::sun::star::drawing::HomogenMatrix& rMatrixOut)
54 rMatrixOut.Line1.Column1 = rMatrixIn.get(0, 0);
55 rMatrixOut.Line1.Column2 = rMatrixIn.get(0, 1);
56 rMatrixOut.Line1.Column3 = rMatrixIn.get(0, 2);
57 rMatrixOut.Line1.Column4 = rMatrixIn.get(0, 3);
58 rMatrixOut.Line2.Column1 = rMatrixIn.get(1, 0);
59 rMatrixOut.Line2.Column2 = rMatrixIn.get(1, 1);
60 rMatrixOut.Line2.Column3 = rMatrixIn.get(1, 2);
61 rMatrixOut.Line2.Column4 = rMatrixIn.get(1, 3);
62 rMatrixOut.Line3.Column1 = rMatrixIn.get(2, 0);
63 rMatrixOut.Line3.Column2 = rMatrixIn.get(2, 1);
64 rMatrixOut.Line3.Column3 = rMatrixIn.get(2, 2);
65 rMatrixOut.Line3.Column4 = rMatrixIn.get(2, 3);
66 rMatrixOut.Line4.Column1 = rMatrixIn.get(3, 0);
67 rMatrixOut.Line4.Column2 = rMatrixIn.get(3, 1);
68 rMatrixOut.Line4.Column3 = rMatrixIn.get(3, 2);
69 rMatrixOut.Line4.Column4 = rMatrixIn.get(3, 3);
71 } // end of namespace tools
72 } // end of namespace basegfx
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */