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