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_AffineMatrix3D_idl__ 24cdf0e10cSrcweir#define __com_sun_star_geometry_AffineMatrix3D_idl__ 25cdf0e10cSrcweir 26cdf0e10cSrcweirmodule com { module sun { module star { module geometry { 27cdf0e10cSrcweir 28cdf0e10cSrcweir/** This structure defines a 3 by 4 affine matrix.<p> 29cdf0e10cSrcweir 30cdf0e10cSrcweir The matrix defined by this structure constitutes an affine mapping 31cdf0e10cSrcweir of a point in 3D to another point in 3D. The last line of a 32c47da6eaSmseidel complete 4 by 4 matrix is omitted, since it is implicitly assumed 33cdf0e10cSrcweir to be [0,0,0,1].<p> 34cdf0e10cSrcweir 35cdf0e10cSrcweir An affine mapping, as performed by this matrix, can be written out 36cdf0e10cSrcweir as follows, where <code>xs, ys</code> and <code>zs</code> are the source, and 37cdf0e10cSrcweir <code>xd, yd</code> and <code>zd</code> the corresponding result coordinates: 38cdf0e10cSrcweir 39cdf0e10cSrcweir <code> 40cdf0e10cSrcweir xd = m00*xs + m01*ys + m02*zs + m03; 41cdf0e10cSrcweir yd = m10*xs + m11*ys + m12*zs + m13; 42cdf0e10cSrcweir zd = m20*xs + m21*ys + m22*zs + m23; 43cdf0e10cSrcweir </code><p> 44cdf0e10cSrcweir 45cdf0e10cSrcweir Thus, in common matrix language, with M being the 46cdf0e10cSrcweir <type>AffineMatrix3D</type> and vs=[xs,ys,zs]^T, vd=[xd,yd,zd]^T two 3D 47cdf0e10cSrcweir vectors, the affine transformation is written as 48cdf0e10cSrcweir vd=M*vs. Concatenation of transformations amounts to 49cdf0e10cSrcweir multiplication of matrices, i.e. a translation, given by T, 50cdf0e10cSrcweir followed by a rotation, given by R, is expressed as vd=R*(T*vs) in 51cdf0e10cSrcweir the above notation. Since matrix multiplication is associative, 52cdf0e10cSrcweir this can be shortened to vd=(R*T)*vs=M'*vs. Therefore, a set of 53cdf0e10cSrcweir consecutive transformations can be accumulated into a single 54cdf0e10cSrcweir AffineMatrix3D, by multiplying the current transformation with the 55cdf0e10cSrcweir additional transformation from the left.<p> 56cdf0e10cSrcweir 57cdf0e10cSrcweir Due to this transformational approach, all geometry data types are 58cdf0e10cSrcweir points in abstract integer or real coordinate spaces, without any 59cdf0e10cSrcweir physical dimensions attached to them. This physical measurement 60cdf0e10cSrcweir units are typically only added when using these data types to 61cdf0e10cSrcweir render something onto a physical output device. For 3D coordinates 62*7de601c3SJohn Bampton there is also a projection from 3D to 2D device coordinates needed. 63cdf0e10cSrcweir Only then the total transformation matrix (oncluding projection to 2D) 64cdf0e10cSrcweir and the device resolution determine the actual measurement unit in 3D.<p> 65cdf0e10cSrcweir 6696af39f7SJürgen Schmidt @since OpenOffice 2.0 67cdf0e10cSrcweir */ 68cdf0e10cSrcweirstruct AffineMatrix3D 69cdf0e10cSrcweir{ 70cdf0e10cSrcweir /// The top, left matrix entry. 71cdf0e10cSrcweir double m00; 72cdf0e10cSrcweir 73cdf0e10cSrcweir /// The top, left middle matrix entry. 74cdf0e10cSrcweir double m01; 75cdf0e10cSrcweir 76cdf0e10cSrcweir /// The top, right middle matrix entry. 77cdf0e10cSrcweir double m02; 78cdf0e10cSrcweir 79cdf0e10cSrcweir /// The top, right matrix entry. 80cdf0e10cSrcweir double m03; 81cdf0e10cSrcweir 82cdf0e10cSrcweir /// The middle, left matrix entry. 83cdf0e10cSrcweir double m10; 84cdf0e10cSrcweir 85cdf0e10cSrcweir /// The middle, middle left matrix entry. 86cdf0e10cSrcweir double m11; 87cdf0e10cSrcweir 88cdf0e10cSrcweir /// The middle, middle right matrix entry. 89cdf0e10cSrcweir double m12; 90cdf0e10cSrcweir 91cdf0e10cSrcweir /// The middle, right matrix entry. 92cdf0e10cSrcweir double m13; 93cdf0e10cSrcweir 94cdf0e10cSrcweir /// The bottom, left matrix entry. 95cdf0e10cSrcweir double m20; 96cdf0e10cSrcweir 97cdf0e10cSrcweir /// The bottom, middle left matrix entry. 98cdf0e10cSrcweir double m21; 99cdf0e10cSrcweir 100cdf0e10cSrcweir /// The bottom, middle right matrix entry. 101cdf0e10cSrcweir double m22; 102cdf0e10cSrcweir 103cdf0e10cSrcweir /// The bottom, right matrix entry. 104cdf0e10cSrcweir double m23; 105cdf0e10cSrcweir}; 106cdf0e10cSrcweir 107cdf0e10cSrcweir}; }; }; }; 108cdf0e10cSrcweir 109cdf0e10cSrcweir#endif 110