PoseTransform.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006-2011, SRI International (R)
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU Lesser General Public License as published by
00006  * the Free Software Foundation, either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #pragma once
00019 
00020 #ifndef __OpenKarto__PoseTransform_h__
00021 #define __OpenKarto__PoseTransform_h__
00022 
00023 #include <OpenKarto/Geometry.h>
00024 
00025 namespace karto
00026 {
00027 
00029 
00030 
00034   class KARTO_EXPORT Transform
00035   {
00036   public:
00040     Transform();
00041 
00046     Transform(const Pose2& rPose);
00047 
00053     Transform(const Pose2& rPose1, const Pose2& rPose2);
00054 
00055   public:
00061     inline Pose2 TransformPose(const Pose2& rSourcePose) const
00062     {
00063       Pose2 newPosition = m_Transform + m_Rotation * rSourcePose;
00064       kt_double angle = math::NormalizeAngle(rSourcePose.GetHeading() + m_Transform.GetHeading());
00065 
00066       return Pose2(newPosition.GetPosition(), angle);
00067     }
00068 
00074     inline Pose2 InverseTransformPose(const Pose2& rSourcePose) const
00075     {
00076       Pose2 newPosition = m_InverseRotation * (rSourcePose - m_Transform);
00077       kt_double angle = math::NormalizeAngle(rSourcePose.GetHeading() - m_Transform.GetHeading());
00078 
00079       // components of transform
00080       return Pose2(newPosition.GetPosition(), angle);
00081     }
00082 
00083   private:
00089     void SetTransform(const Pose2& rPose1, const Pose2& rPose2);
00090 
00091   private:
00092     // pose transformation
00093     Pose2 m_Transform;
00094 
00095     Matrix3 m_Rotation;
00096     Matrix3 m_InverseRotation;
00097   }; // Transform
00098 
00100 
00101 }
00102 
00103 #endif // __OpenKarto__PoseTransform_h__


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Mon Oct 6 2014 02:44:17