/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef __com_sun_star_geometry_Matrix2D_idl__
#define __com_sun_star_geometry_Matrix2D_idl__

module com {  module sun {  module star {  module geometry {

/** This structure defines a 2 by 2 matrix.<p>

    This constitutes a linear mapping of a point in 2D to another
    point in 2D.<p>

    The matrix defined by this structure constitutes a linear
    mapping of a point in 2D to another point in 2D. In contrast to
    the com.sun.star.geometry.AffineMatrix2D, this
    matrix does not include any translational components.<p>

    A linear mapping, as performed by this matrix, can be written out
    as follows, where <code>xs</code> and <code>ys</code> are the source, and
    <code>xd</code> and <code>yd</code> the corresponding result coordinates:

    <code>
        xd = m00*xs + m01*ys;
        yd = m10*xs + m11*ys;
    </code><p>

    Thus, in common matrix language, with M being the
    Matrix2D and vs=[xs,ys]^T, vd=[xd,yd]^T two 2D
    vectors, the linear mapping is written as
    vd=M*vs. Concatenation of transformations amounts to
    multiplication of matrices, i.e. a scaling, given by S,
    followed by a rotation, given by R, is expressed as vd=R*(S*vs) in
    the above notation. Since matrix multiplication is associative,
    this can be shortened to vd=(R*S)*vs=M'*vs. Therefore, a set of
    consecutive transformations can be accumulated into a single
    Matrix2D, by multiplying the current transformation with the
    additional transformation from the left.<p>

    Due to this transformational approach, all geometry data types are
    points in abstract integer or real coordinate spaces, without any
    physical dimensions attached to them. This physical measurement
    units are typically only added when using these data types to
    render something onto a physical output device, like a screen or a
    printer. Then, the total transformation matrix and the device
    resolution determine the actual measurement unit.<p>

    @since OOo 2.0
 */
struct Matrix2D
{
    /// The top, left matrix entry.
    double m00;

    /// The top, right matrix entry.
    double m01;

    /// The bottom, left matrix entry.
    double m10;

    /// The bottom, right matrix entry.
    double m11;
};

}; }; }; };

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
