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