xref: /trunk/main/offapi/com/sun/star/geometry/Matrix2D.idl (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_geometry_Matrix2D_idl__
24cdf0e10cSrcweir#define __com_sun_star_geometry_Matrix2D_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweirmodule com {  module sun {  module star {  module geometry {
27cdf0e10cSrcweir
28cdf0e10cSrcweir/** This structure defines a 2 by 2 matrix.<p>
29cdf0e10cSrcweir
30cdf0e10cSrcweir    This constitutes a linear mapping of a point in 2D to another
31cdf0e10cSrcweir    point in 2D.<p>
32cdf0e10cSrcweir
33cdf0e10cSrcweir    The matrix defined by this structure constitutes a linear
34cdf0e10cSrcweir    mapping of a point in 2D to another point in 2D. In contrast to
35cdf0e10cSrcweir    the <type>com.sun.star.geometry.AffineMatrix2D</type>, this
36cdf0e10cSrcweir    matrix does not include any translational components.<p>
37cdf0e10cSrcweir
38cdf0e10cSrcweir    A linear mapping, as performed by this matrix, can be written out
39cdf0e10cSrcweir    as follows, where <code>xs</code> and <code>ys</code> are the source, and
40cdf0e10cSrcweir    <code>xd</code> and <code>yd</code> the corresponding result coordinates:
41cdf0e10cSrcweir
42cdf0e10cSrcweir    <code>
43cdf0e10cSrcweir        xd = m00*xs + m01*ys;
44cdf0e10cSrcweir        yd = m10*xs + m11*ys;
45cdf0e10cSrcweir    </code><p>
46cdf0e10cSrcweir
47cdf0e10cSrcweir    Thus, in common matrix language, with M being the
48cdf0e10cSrcweir    <type>Matrix2D</type> and vs=[xs,ys]^T, vd=[xd,yd]^T two 2D
49cdf0e10cSrcweir    vectors, the linear mapping is written as
50cdf0e10cSrcweir    vd=M*vs. Concatenation of transformations amounts to
51cdf0e10cSrcweir    multiplication of matrices, i.e. a scaling, given by S,
52cdf0e10cSrcweir    followed by a rotation, given by R, is expressed as vd=R*(S*vs) in
53cdf0e10cSrcweir    the above notation. Since matrix multiplication is associative,
54cdf0e10cSrcweir    this can be shortened to vd=(R*S)*vs=M'*vs. Therefore, a set of
55cdf0e10cSrcweir    consecutive transformations can be accumulated into a single
56cdf0e10cSrcweir    Matrix2D, by multiplying the current transformation with the
57cdf0e10cSrcweir    additional transformation from the left.<p>
58cdf0e10cSrcweir
59cdf0e10cSrcweir    Due to this transformational approach, all geometry data types are
60cdf0e10cSrcweir    points in abstract integer or real coordinate spaces, without any
61cdf0e10cSrcweir    physical dimensions attached to them. This physical measurement
62cdf0e10cSrcweir    units are typically only added when using these data types to
63cdf0e10cSrcweir    render something onto a physical output device, like a screen or a
64cdf0e10cSrcweir    printer. Then, the total transformation matrix and the device
65cdf0e10cSrcweir    resolution determine the actual measurement unit.<p>
66cdf0e10cSrcweir
67*96af39f7SJürgen Schmidt    @since OpenOffice 2.0
68cdf0e10cSrcweir */
69cdf0e10cSrcweirpublished struct Matrix2D
70cdf0e10cSrcweir{
71cdf0e10cSrcweir    /// The top, left matrix entry.
72cdf0e10cSrcweir    double m00;
73cdf0e10cSrcweir
74cdf0e10cSrcweir    /// The top, right matrix entry.
75cdf0e10cSrcweir    double m01;
76cdf0e10cSrcweir
77cdf0e10cSrcweir    /// The bottom, left matrix entry.
78cdf0e10cSrcweir    double m10;
79cdf0e10cSrcweir
80cdf0e10cSrcweir    /// The bottom, right matrix entry.
81cdf0e10cSrcweir    double m11;
82cdf0e10cSrcweir};
83cdf0e10cSrcweir
84cdf0e10cSrcweir}; }; }; };
85cdf0e10cSrcweir
86cdf0e10cSrcweir#endif
87