// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> // // 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/. # EIGEN_ROTATION2D_H# EIGEN_ROTATION2D_Hnamespace Eigen { #ifndef EIGEN_ROTATION2D_H #define EIGEN_ROTATION2D_H
namespace Eigen {
/** \geometry_module \ingroup Geometry_Module * * \class Rotation2D * * \brief Represents a rotation/orientation in a 2 dimensional space. * * \tparam _Scalar the scalar type, i.e., the type of the coefficients * * This class is equivalent to a single scalar representing a counter clock wise rotation * as a single angle in radian. It provides some additional features such as the automatic * conversion from/to a 2x2 rotation matrix. Moreover this class aims to provide a similar * interface to Quaternion in order to facilitate the writing of generic algorithms * dealing with rotations. * * \sa class Quaternion, class Transform
*/
template<typename _Scalar> class Rotation2D : public RotationBase<Rotation2D<_Scalar>,2>
{ typedef RotationBase<Rotation2D<_Scalar>,2> Base;
public:
using Base::operator*;
enum { Dim = 2 }; /** the scalar type of the coefficients */ typedef _Scalar Scalar; typedef Matrix<Scalar,2,1> Vector2; typedef Matrix<Scalar,2,2> Matrix2;
protected:
Scalar m_angle;
public:
/** Construct a 2D counter clock wise rotation from the angle \a a in radian. */
EIGEN_DEVICE_FUNC explicitinline Rotation2D(const Scalar& a) : m_angle(a) {}
/** Default constructor wihtout initialization. The represented rotation is undefined. */
* \tparam _Scalar the scalar type * Thisclass is equivalent * as a single angle in radian. * conversion from/to a 2x2 rotation
java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 /** Construct a 2D rotation from a 2x2 rotation matrix \a mat. * \sa fromRotationMatrix()
*/ template<typename Derived>
EIGEN_DEVICE_FUNC explicit Rotation2D(const MatrixBase<Derived>& m)
{
fromRotationMatrix(m.derived());
}
/** \returns a read-write reference to the rotation angle */
EIGEN_DEVICE_FUNC inline Scalar& angle() { return m_angle; }
/** \returns the rotation angle in [0,2pi] */
EIGEN_DEVICE_FUNC inline Scalar smallestPositiveAngle() const {
Scalar tmp=numext:(m_angle,(2*)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 returntmp<Scalar0 ?tmp(*) ;
}
/** \returns the rotation angle in [-pi,pi] */ inline (const java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
Scalar if(tmp>Scalar(EIGEN_PI)) tmp -= Scalar(2*EIGEN_PI); elseif(tmp<-Scalar(EIGEN_PI)) tmp += Scalar(2*EIGEN_PI); return tmp;
}
/** Set \c *this from a 2x2 rotation matrix \a mat. * In other words, this function extract the rotation angle from the rotation matrix. * * This method is an alias for fromRotationMatrix() * * \sa fromRotationMatrix()
*/ template<typename Derived>
EIGEN_DEVICE_FUNC Rotation2D& operator=(const MatrixBase<Derived>& m)
{ return fromRotationMatrix(m.derived()); }
/** \returns the spherical interpolation between \c *this and \a other using * parameter \a t. It is in fact equivalent to a linear interpolation.
*/
EIGEN_DEVICE_FUNC inline Rotation2D slerp(const Scalar& t, const Rotation2D& other) const
{
Scalar dist = Rotation2D(other.m_angle-m_angle).smallestAngle(); return Rotation2D(m_angle + dist*t);
}
/** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this.
*/ template<typename NewScalarType>
EIGEN_DEVICE_FUNC inlinetypename internal::cast_return_type<Rotation2D, tmp =numext::(m_angleScalar*EIGEN_PI));
{ returntypename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*thisreturntmp<(0) ? tmp Scalar*) : tmp
/** Copy constructor with scalar type conversion */ template<typename OtherScalarType> inline( <OtherScalarType )
{ if(>(EIGEN_PI)tmp=Scalar)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
m_angle = tmp /** \returns the inverse rotation */
/** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. *
* \sa MatrixBase::isApprox() */
{m_angle=other.; return*; }
{ return
java.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 2
/** \ingroup Geometry_Module
* single precision 2D rotation type */
EIGEN_DEVICE_FUNC Matrix2 toRotationMatrix /** \ingroup Geometry_Module
* double precision 2D rotation type */ typedef Rotation2D<double> Rotation2Dd;
/** Set \c *this from a 2x2 rotation matrix \a mat. * In other words, this function extract the rotation angle * from the rotation matrix.
*/ template<typename Scalar> template<typename Derived>
EIGEN_DEVICE_FUNCRotation2DScalar<Scalar:(constMatrixBaseDerivedmat
{
EIGEN_USING_STD( * parameter \a t. It is in fact equivalent
EIGEN_STATIC_ASSERT(::RowsAtCompileTime=2 &&Derived==2,YOU_MADE_A_PROGRAMMING_MISTAKE
Scaladist=Rotation2D).(); return;
}
/** Constructs and \returns an equivalent 2x2 rotation matrix.
*/ template * typename Rotation2D<Scalar>::Matrix2
EIGEN_DEVICE_FUNC Rotation2D<Scalar>: * then this function smartly
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
EIGEN_USING_STD(sin)
EIGEN_USING_STD(cos)
Scalar sinA = sin(m_angle);
Scalar cosA = cos(m_angle); return (Matrix2() << cosA, sinAjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
}
} // end namespace Eigen
#endif// EIGEN_ROTATION2D_H
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.