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_AffineMatrix2D_idl__ 24*b1cdbd2cSJim Jagielski#define __com_sun_star_geometry_AffineMatrix2D_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 3 affine matrix.<p> 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski The matrix defined by this structure constitutes an affine mapping 31*b1cdbd2cSJim Jagielski of a point in 2D to another point in 2D. The last line of a 32*b1cdbd2cSJim Jagielski complete 3 by 3 matrix is omitted, since it is implicitely assumed 33*b1cdbd2cSJim Jagielski to be [0,0,1].<p> 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski An affine mapping, as performed by this matrix, can be written out 36*b1cdbd2cSJim Jagielski as follows, where <code>xs</code> and <code>ys</code> are the source, and 37*b1cdbd2cSJim Jagielski <code>xd</code> and <code>yd</code> the corresponding result coordinates: 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski <code> 40*b1cdbd2cSJim Jagielski xd = m00*xs + m01*ys + m02; 41*b1cdbd2cSJim Jagielski yd = m10*xs + m11*ys + m12; 42*b1cdbd2cSJim Jagielski </code><p> 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim Jagielski Thus, in common matrix language, with M being the 45*b1cdbd2cSJim Jagielski <type>AffineMatrix2D</type> and vs=[xs,ys]^T, vd=[xd,yd]^T two 2D 46*b1cdbd2cSJim Jagielski vectors, the affine transformation is written as 47*b1cdbd2cSJim Jagielski vd=M*vs. Concatenation of transformations amounts to 48*b1cdbd2cSJim Jagielski multiplication of matrices, i.e. a translation, given by T, 49*b1cdbd2cSJim Jagielski followed by a rotation, given by R, is expressed as vd=R*(T*vs) in 50*b1cdbd2cSJim Jagielski the above notation. Since matrix multiplication is associative, 51*b1cdbd2cSJim Jagielski this can be shortened to vd=(R*T)*vs=M'*vs. Therefore, a set of 52*b1cdbd2cSJim Jagielski consecutive transformations can be accumulated into a single 53*b1cdbd2cSJim Jagielski AffineMatrix2D, by multiplying the current transformation with the 54*b1cdbd2cSJim Jagielski additional transformation from the left.<p> 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski Due to this transformational approach, all geometry data types are 57*b1cdbd2cSJim Jagielski points in abstract integer or real coordinate spaces, without any 58*b1cdbd2cSJim Jagielski physical dimensions attached to them. This physical measurement 59*b1cdbd2cSJim Jagielski units are typically only added when using these data types to 60*b1cdbd2cSJim Jagielski render something onto a physical output device, like a screen or a 61*b1cdbd2cSJim Jagielski printer, Then, the total transformation matrix and the device 62*b1cdbd2cSJim Jagielski resolution determine the actual measurement unit.<p> 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski @since OpenOffice 2.0 65*b1cdbd2cSJim Jagielski */ 66*b1cdbd2cSJim Jagielskipublished struct AffineMatrix2D 67*b1cdbd2cSJim Jagielski{ 68*b1cdbd2cSJim Jagielski /// The top, left matrix entry. 69*b1cdbd2cSJim Jagielski double m00; 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski /// The top, middle matrix entry. 72*b1cdbd2cSJim Jagielski double m01; 73*b1cdbd2cSJim Jagielski 74*b1cdbd2cSJim Jagielski /// The top, right matrix entry. 75*b1cdbd2cSJim Jagielski double m02; 76*b1cdbd2cSJim Jagielski 77*b1cdbd2cSJim Jagielski /// The bottom, left matrix entry. 78*b1cdbd2cSJim Jagielski double m10; 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski /// The bottom, middle matrix entry. 81*b1cdbd2cSJim Jagielski double m11; 82*b1cdbd2cSJim Jagielski 83*b1cdbd2cSJim Jagielski /// The bottom, right matrix entry. 84*b1cdbd2cSJim Jagielski double m12; 85*b1cdbd2cSJim Jagielski}; 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski}; }; }; }; 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim Jagielski#endif 90