From 6825c8dd6ba8bdbc2b34dda832e5a91a7c382676 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 1 Sep 2008 06:33:19 +0000 Subject: QTransform conversion and doc --- doc/QuickStartGuide.dox | 221 ++---------------------------------------------- 1 file changed, 9 insertions(+), 212 deletions(-) (limited to 'doc/QuickStartGuide.dox') diff --git a/doc/QuickStartGuide.dox b/doc/QuickStartGuide.dox index 96497073d..8d1799fdd 100644 --- a/doc/QuickStartGuide.dox +++ b/doc/QuickStartGuide.dox @@ -188,7 +188,7 @@ MatrixXi mat2x2 = Map(data,2,2); \subsection TutorialCommaInit Comma initializer -Eigen also offer a \ref MatrixBaseCommaInitRef "comma initializer syntax" which allows you to set all the coefficients of a matrix to specific values: +Eigen also offers a \ref MatrixBaseCommaInitRef "comma initializer syntax" which allows you to set all the coefficients of a matrix to specific values: @@ -259,7 +259,7 @@ vec3 = vec1.cross(vec2);\endcode In Eigen only mathematically well defined operators can be used right away, but don't worry, thanks to the \link Cwise .cwise() \endlink operator prefix, -Eigen's matrices also provide a very powerful numerical container supporting +Eigen's matrices are also very powerful as a numerical container supporting most common coefficient wise operators:
\include Tutorial_commainit_01.cpp
@@ -322,14 +322,14 @@ mat3 = mat1.cwise().abs2(mat2);
-\b Side \b note: If you feel the \c .cwise() syntax is too verbose for your taste and don't bother to have non mathematical operator directly available feel free to extend MatrixBase as described \ref ExtendingMatrixBase "here". +\b Side \b note: If you feel the \c .cwise() syntax is too verbose for your taste and don't bother to have non mathematical operator directly available, then feel free to extend MatrixBase as described \ref ExtendingMatrixBase "here". top\section TutorialCoreReductions Reductions -Eigen provides several several reduction methods such as: +Eigen provides several reduction methods such as: \link MatrixBase::minCoeff() minCoeff() \endlink, \link MatrixBase::maxCoeff() maxCoeff() \endlink, \link MatrixBase::sum() sum() \endlink, \link MatrixBase::trace() trace() \endlink, \link MatrixBase::norm() norm() \endlink, \link MatrixBase::norm2() norm2() \endlink, @@ -370,28 +370,22 @@ Read-write access to sub-vectors: - + - -
Default versionsOptimized versions when the size is known at compile time
Optimized versions when the size \n is known at compile time
\code vec1.start(n)\endcode\code vec1.start()\endcodethe first \c n coeffs
\code vec1.end(n)\endcode\code vec1.end()\endcodethe last \c n coeffs
\code vec1.block(pos,n)\endcode\code vec1.block(pos)\endcodethe \c size coeffs in the range [\c pos : \c pos + \c n [
- -Read-write access to sub-matrices: - - - + + - - - + - - -/** \page TutorialGeometry Tutorial 2/3 - Geometry - \ingroup Tutorial - \internal - -
\ref index "Overview" - | \ref TutorialCore "Core features" - | \b Geometry - | \ref TutorialAdvancedLinearAlgebra "Advanced linear algebra" -
- -In this tutorial chapter we will shortly introduce the many possibilities offered by the \ref GeometryModule "geometry module", -namely 2D and 3D rotations and affine transformations. - -\b Table \b of \b contents - - \ref TutorialGeoRotations - - \ref TutorialGeoTransformation - -\section TutorialGeoRotations 2D and 3D Rotations - -\subsection TutorialGeoRotationTypes Rotation types - - -
Default versionsOptimized versions when the size is known at compile time
the \c size coeffs in \n the range [\c pos : \c pos + \c n [
+Read-write access to sub-matrices:
\code mat1.block(i,j,rows,cols)\endcode \link MatrixBase::block(int,int,int,int) (more) \endlink \code mat1.block(i,j)\endcode \link MatrixBase::block(int,int) (more) \endlinkthe \c rows x \c cols sub-matrix starting from position (\c i,\c j)
the \c rows x \c cols sub-matrix \n starting from position (\c i,\c j)
\code mat1.corner(TopLeft,rows,cols) mat1.corner(TopRight,rows,cols) @@ -493,203 +487,6 @@ forces immediate evaluation of the transpose
- - - - - - -
Rotation typeTypical initialization codeRecommended usage
2D rotation from an angle\code -Rotation2D rot2(angle_in_radian);\endcode
2D rotation matrix\code -Matrix2f rotmat2 = Rotation2Df(angle_in_radian);\endcode
3D rotation as an angle + axis\code -AngleAxis aa(angle_in_radian, Vector3f(ax,ay,az));\endcode
3D rotation as a quaternion\code -Quaternion q = AngleAxis(angle_in_radian, axis);\endcode
3D rotation matrix\code -Matrix3f rotmat3 = AngleAxis(angle_in_radian, axis);\endcode
- -To transform more than a single vector the prefered representations are rotation matrices, -for other usage Rotation2D and Quaternion are the representations of choice as they are -more compact, fast and stable. AngleAxis are only useful to create other rotation objects. - -\subsection TutorialGeoCommonRotationAPI Common API across rotation types - -To some extent, Eigen's \ref GeometryModule "geometry module" allows you to write -generic algorithms working on both 2D and 3D rotations of any of the five above types. -The following operation are supported: - - - - - - -
Convertion from and to any types (of same space dimension)\code -RotType2 a = RotType1();\endcode
Concatenation of two rotations\code -rot3 = rot1 * rot2;\endcode
Apply the rotation to a vector\code -vec2 = rot1 * vec1;\endcode
Get the inverse rotation \n (not always the most effient choice)\code -rot2 = rot1.inverse();\endcode
Spherical interpolation \n (Rotation2D and Quaternion only)\code -rot3 = rot1.slerp(alpha,rot2);\endcode
- -\subsection TutorialGeoEulerAngles Euler angles - - -
-Euler angles might be convenient to create rotation object. -Since there exist 24 differents convensions, they are one -the ahand pretty confusing to use. This example shows how -to create a rotation matrix according to the 2-1-2 convention.\code -Matrix3f m; -m = AngleAxisf(angle1, Vector3f::UnitZ()) - * AngleAxisf(angle2, Vector3f::UnitY()) - * AngleAxisf(angle3, Vector3f::UnitZ()); -\endcode
- -top\section TutorialGeoTransformation Affine transformations -In Eigen we have chosen to not distinghish between points and vectors such that all points are -actually represented by displacement vectors from the origine ( \f$ \mathbf{p} \equiv \mathbf{p}-0 \f$ ). -With that in mind, real points and vector distinguish when the rotation is applied. - - - - - - - - - - - - - - -
\b 3D \b 2D
Creation \n rot2D can also be an angle in radian\code -Transform3f t; -t.fromPositionOrientationScale( - pos,any_3D_rotation,Vector3f(sx,sy,sz)); \endcode\code -Transform2f t; -t.fromPositionOrientationScale( - pos,any_2D_rotation,Vector2f(sx,sy)); \endcode
Apply the transformation to a \b point \code -Vector3f p1, p2; -p2 = t * p1;\endcode\code -Vector2f p1, p2; -p2 = t * p1;\endcode
Apply the transformation to a \b vector \code -Vector3f v1, v2; -v2 = t.linear() * v1;\endcode\code -Vector2f v1, v2; -v2 = t.linear() * v1;\endcode
Apply a \em general transformation \n to a \b normal \b vector -(explanations)\code -Matrix{3,2}f normalMatrix = t.linear().inverse().transpose(); -n2 = (normalMatrix * n1).normalize();\endcode
Apply a transformation with \em pure \em rotation \n to a \b normal \b vector -(no scaling, no shear)\code -n2 = t.linear() * n1;\endcode
Concatenate two transformations\code -t3 = t1 * t2;\endcode
OpenGL compatibility\code -glLoadMatrixf(t.data());\endcode\code -Transform3f aux(Transform3f::Identity); -aux.linear().corner<2,2>(TopLeft) = t.linear(); -aux.translation().start<2>() = t.translation(); -glLoadMatrixf(aux.data());\endcode
\b Component \b accessors
full read-write access to the internal matrix\code -t.matrix() = mat4x4; -mat4x4 = t.matrix(); -\endcode\code -t.matrix() = mat3x3; -mat3x3 = t.matrix(); -\endcode
coefficient accessors\code -t(i,j) = scalar; <=> t.matrix()(i,j) = scalar; -scalar = t(i,j); <=> scalar = t.matrix()(i,j); -\endcode
translation part\code -t.translation() = vec3; -vec3 = t.translation(); -\endcode\code -t.translation() = vec2; -vec2 = t.translation(); -\endcode
linear part\code -t.linear() = mat3x3; -mat3x3 = t.linear(); -\endcode\code -t.linear() = mat2x2; -mat2x2 = t.linear(); -\endcode
- -\b Transformation \b creation \n -Eigen's geometry module offer two different ways to build and update transformation objects. - - - - - - -
\b procedurale \b API \b natural \b API
Translation\code -t.translate(Vector_(tx, ty, ...)); - -t.pretranslate(Vector_(tx, ty, ...)); -\endcode\code -t *= Translation_(tx, ty, ...); -t2 = t1 * Translation_(vec); -t = Translation_(tx, ty, ...) * t; -\endcode
Rotation \n In 2D, any_rotation can also \n be an angle in radian\code -t.rotate(any_rotation); - -t.prerotate(any_rotation); -\endcode\code -t *= any_rotation; -t2 = t1 * any_rotation; -t = any_rotation * t; -\endcode
Scaling\code -t.scale(Vector_(sx, sy, ...)); - -t.scale(s); -t.prescale(Vector_(sx, sy, ...)); -t.prescale(s); -\endcode\code -t *= Scaling_(sx, sy, ...); -t2 = t1 * Scaling_(vec); -t *= Scaling_(s); -t = Scaling_(sx, sy, ...) * t; -t = Scaling_(s) * t; -\endcode
Shear transformation \n ( \b 2D \b only ! )\code -t.shear(sx,sy); -t.preshear(sx,sy); -\endcode
- -Note that in both API, any many transformations can be concatenated in a single expression as shown in the two following equivalent examples: - - - -
\code -t.pretranslate(..).rotate(..).translate(..).scale(..); -\endcode
\code -t = Translation_(..) * t * RotationType(..) * Translation_(..) * Scaling_(..); -\endcode
- -*/ - - - - - /** \page TutorialAdvancedLinearAlgebra Tutorial 3/3 - Advanced linear algebra \ingroup Tutorial -- cgit v1.2.3