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