/src/libreoffice/basegfx/source/matrix/b3dhommatrixtools.cxx
Line | Count | Source |
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 | | #include <basegfx/matrix/b3dhommatrixtools.hxx> |
21 | | #include <basegfx/matrix/b3dhommatrix.hxx> |
22 | | #include <com/sun/star/drawing/HomogenMatrix.hpp> |
23 | | |
24 | | namespace basegfx::utils |
25 | | { |
26 | | B3DHomMatrix UnoHomogenMatrixToB3DHomMatrix(const css::drawing::HomogenMatrix& rMatrixIn) |
27 | 0 | { |
28 | 0 | B3DHomMatrix aRetval; |
29 | |
|
30 | 0 | aRetval.set(0, 0, rMatrixIn.Line1.Column1); |
31 | 0 | aRetval.set(0, 1, rMatrixIn.Line1.Column2); |
32 | 0 | aRetval.set(0, 2, rMatrixIn.Line1.Column3); |
33 | 0 | aRetval.set(0, 3, rMatrixIn.Line1.Column4); |
34 | 0 | aRetval.set(1, 0, rMatrixIn.Line2.Column1); |
35 | 0 | aRetval.set(1, 1, rMatrixIn.Line2.Column2); |
36 | 0 | aRetval.set(1, 2, rMatrixIn.Line2.Column3); |
37 | 0 | aRetval.set(1, 3, rMatrixIn.Line2.Column4); |
38 | 0 | aRetval.set(2, 0, rMatrixIn.Line3.Column1); |
39 | 0 | aRetval.set(2, 1, rMatrixIn.Line3.Column2); |
40 | 0 | aRetval.set(2, 2, rMatrixIn.Line3.Column3); |
41 | 0 | aRetval.set(2, 3, rMatrixIn.Line3.Column4); |
42 | 0 | aRetval.set(3, 0, rMatrixIn.Line4.Column1); |
43 | 0 | aRetval.set(3, 1, rMatrixIn.Line4.Column2); |
44 | 0 | aRetval.set(3, 2, rMatrixIn.Line4.Column3); |
45 | 0 | aRetval.set(3, 3, rMatrixIn.Line4.Column4); |
46 | |
|
47 | 0 | return aRetval; |
48 | 0 | } |
49 | | |
50 | | void B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn, |
51 | | css::drawing::HomogenMatrix& rMatrixOut) |
52 | 0 | { |
53 | 0 | rMatrixOut.Line1.Column1 = rMatrixIn.get(0, 0); |
54 | 0 | rMatrixOut.Line1.Column2 = rMatrixIn.get(0, 1); |
55 | 0 | rMatrixOut.Line1.Column3 = rMatrixIn.get(0, 2); |
56 | 0 | rMatrixOut.Line1.Column4 = rMatrixIn.get(0, 3); |
57 | 0 | rMatrixOut.Line2.Column1 = rMatrixIn.get(1, 0); |
58 | 0 | rMatrixOut.Line2.Column2 = rMatrixIn.get(1, 1); |
59 | 0 | rMatrixOut.Line2.Column3 = rMatrixIn.get(1, 2); |
60 | 0 | rMatrixOut.Line2.Column4 = rMatrixIn.get(1, 3); |
61 | 0 | rMatrixOut.Line3.Column1 = rMatrixIn.get(2, 0); |
62 | 0 | rMatrixOut.Line3.Column2 = rMatrixIn.get(2, 1); |
63 | 0 | rMatrixOut.Line3.Column3 = rMatrixIn.get(2, 2); |
64 | 0 | rMatrixOut.Line3.Column4 = rMatrixIn.get(2, 3); |
65 | 0 | rMatrixOut.Line4.Column1 = rMatrixIn.get(3, 0); |
66 | 0 | rMatrixOut.Line4.Column2 = rMatrixIn.get(3, 1); |
67 | 0 | rMatrixOut.Line4.Column3 = rMatrixIn.get(3, 2); |
68 | 0 | rMatrixOut.Line4.Column4 = rMatrixIn.get(3, 3); |
69 | 0 | } |
70 | | } // end of namespace |
71 | | |
72 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |