transforms.cpp revision 4115d2a7efa05a72856652c38e52105903318912
/**
* @file
* @brief Affine transformation classes
*//*
* Authors:
* ? <?@?.?>
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
* Johan Engelen
*
* Copyright ?-2012 Authors
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*/
#include <boost/concept_check.hpp>
namespace Geom {
/** @brief Zoom between rectangles.
* Given two rectangles, compute a zoom that maps one to the other.
* Rectangles are assumed to have the same aspect ratio. */
{
return ret;
}
// Point transformation methods.
{
return *this;
}
{
return *this;
}
{
return *this;
}
{
return *this;
}
{
return *this;
}
{
return *this;
}
// Affine multiplication methods.
/** @brief Combine this transformation with a translation. */
_c[4] += t[X];
_c[5] += t[Y];
return *this;
}
/** @brief Combine this transformation with scaling. */
return *this;
}
/** @brief Combine this transformation a rotation. */
// TODO: we just convert the Rotate to an Affine and use the existing operator*=()
// is there a better way?
*this *= (Affine) r;
return *this;
}
/** @brief Combine this transformation with horizontal shearing (skew). */
return *this;
}
/** @brief Combine this transformation with vertical shearing (skew). */
return *this;
}
return *this;
}
// this checks whether the requirements of TransformConcept are satisfied for all transforms.
// if you add a new transform type, include it here!
void check_transforms()
{
#ifdef BOOST_CONCEPT_ASSERT
#endif
// check inter-transform multiplication
Affine m;
// notice that the first column is always the same and enumerates all transform types,
// while the second one changes to each transform type in turn.
m = t * t; m = t * s; m = t * r; m = t * h; m = t * v; m = t * z;
m = s * t; m = s * s; m = s * r; m = s * h; m = s * v; m = s * z;
m = r * t; m = r * s; m = r * r; m = r * h; m = r * v; m = r * z;
m = h * t; m = h * s; m = h * r; m = h * h; m = h * v; m = h * z;
m = v * t; m = v * s; m = v * r; m = v * h; m = v * v; m = v * z;
m = z * t; m = z * s; m = z * r; m = z * h; m = z * v; m = z * z;
}
0 ,0 );
}
} // namespace Geom
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :