xref: /AOO41X/main/offapi/com/sun/star/geometry/Matrix2D.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef __com_sun_star_geometry_Matrix2D_idl__
28*cdf0e10cSrcweir#define __com_sun_star_geometry_Matrix2D_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweirmodule com {  module sun {  module star {  module geometry {
31*cdf0e10cSrcweir
32*cdf0e10cSrcweir/** This structure defines a 2 by 2 matrix.<p>
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir    This constitutes a linear mapping of a point in 2D to another
35*cdf0e10cSrcweir    point in 2D.<p>
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir    The matrix defined by this structure constitutes a linear
38*cdf0e10cSrcweir    mapping of a point in 2D to another point in 2D. In contrast to
39*cdf0e10cSrcweir    the <type>com.sun.star.geometry.AffineMatrix2D</type>, this
40*cdf0e10cSrcweir    matrix does not include any translational components.<p>
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir    A linear mapping, as performed by this matrix, can be written out
43*cdf0e10cSrcweir    as follows, where <code>xs</code> and <code>ys</code> are the source, and
44*cdf0e10cSrcweir    <code>xd</code> and <code>yd</code> the corresponding result coordinates:
45*cdf0e10cSrcweir
46*cdf0e10cSrcweir    <code>
47*cdf0e10cSrcweir        xd = m00*xs + m01*ys;
48*cdf0e10cSrcweir        yd = m10*xs + m11*ys;
49*cdf0e10cSrcweir    </code><p>
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir    Thus, in common matrix language, with M being the
52*cdf0e10cSrcweir    <type>Matrix2D</type> and vs=[xs,ys]^T, vd=[xd,yd]^T two 2D
53*cdf0e10cSrcweir    vectors, the linear mapping is written as
54*cdf0e10cSrcweir    vd=M*vs. Concatenation of transformations amounts to
55*cdf0e10cSrcweir    multiplication of matrices, i.e. a scaling, given by S,
56*cdf0e10cSrcweir    followed by a rotation, given by R, is expressed as vd=R*(S*vs) in
57*cdf0e10cSrcweir    the above notation. Since matrix multiplication is associative,
58*cdf0e10cSrcweir    this can be shortened to vd=(R*S)*vs=M'*vs. Therefore, a set of
59*cdf0e10cSrcweir    consecutive transformations can be accumulated into a single
60*cdf0e10cSrcweir    Matrix2D, by multiplying the current transformation with the
61*cdf0e10cSrcweir    additional transformation from the left.<p>
62*cdf0e10cSrcweir
63*cdf0e10cSrcweir    Due to this transformational approach, all geometry data types are
64*cdf0e10cSrcweir    points in abstract integer or real coordinate spaces, without any
65*cdf0e10cSrcweir    physical dimensions attached to them. This physical measurement
66*cdf0e10cSrcweir    units are typically only added when using these data types to
67*cdf0e10cSrcweir    render something onto a physical output device, like a screen or a
68*cdf0e10cSrcweir    printer. Then, the total transformation matrix and the device
69*cdf0e10cSrcweir    resolution determine the actual measurement unit.<p>
70*cdf0e10cSrcweir
71*cdf0e10cSrcweir    @since OOo 2.0
72*cdf0e10cSrcweir */
73*cdf0e10cSrcweirpublished struct Matrix2D
74*cdf0e10cSrcweir{
75*cdf0e10cSrcweir    /// The top, left matrix entry.
76*cdf0e10cSrcweir    double m00;
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir    /// The top, right matrix entry.
79*cdf0e10cSrcweir    double m01;
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir    /// The bottom, left matrix entry.
82*cdf0e10cSrcweir    double m10;
83*cdf0e10cSrcweir
84*cdf0e10cSrcweir    /// The bottom, right matrix entry.
85*cdf0e10cSrcweir    double m11;
86*cdf0e10cSrcweir};
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir}; }; }; };
89*cdf0e10cSrcweir
90*cdf0e10cSrcweir#endif
91