#ifndef Magnum_Physics_Box_h #define Magnum_Physics_Box_h /* Copyright © 2010, 2011, 2012 Vladimír Vondruš This file is part of Magnum. Magnum is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 only, as published by the Free Software Foundation. Magnum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License version 3 for more details. */ /** @file * @brief Class Magnum::Physics::Box, typedef Magnum::Physics::Box2D, Magnum::Physics::Box3D */ #include "Math/Matrix3.h" #include "Math/Matrix4.h" #include "AbstractShape.h" #include "corradeCompatibility.h" namespace Magnum { namespace Physics { /** @brief Unit-size box with assigned transformation matrix @todo Use quat + position + size instead? @see Box2D, Box3D */ template class MAGNUM_PHYSICS_EXPORT Box: public AbstractShape { public: /** @brief Constructor */ inline Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Box; } void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; /** @brief Transformation */ inline typename DimensionTraits::MatrixType transformation() const { return _transformation; } /** @brief Set transformation */ inline void setTransformation(const typename DimensionTraits::MatrixType& transformation) { _transformation = transformation; } /** @brief Transformed transformation */ inline typename DimensionTraits::MatrixType transformedTransformation() const { return _transformedTransformation; } private: typename DimensionTraits::MatrixType _transformation, _transformedTransformation; }; /** @brief Two-dimensional box */ typedef Box<2> Box2D; /** @brief Three-dimensional box */ typedef Box<3> Box3D; }} #endif