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