Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
OpenKarto
source
PoseTransform.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006-2011, SRI International (R)
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include <
OpenKarto/PoseTransform.h
>
19
20
namespace
karto
21
{
22
23
Transform::Transform
()
24
{
25
SetTransform
(
Pose2
(),
Pose2
());
26
}
27
28
Transform::Transform
(
const
Pose2
& rPose)
29
{
30
SetTransform
(
Pose2
(), rPose);
31
}
32
33
Transform::Transform
(
const
Pose2
& rPose1,
const
Pose2
& rPose2)
34
{
35
SetTransform
(rPose1, rPose2);
36
}
37
38
void
Transform::SetTransform
(
const
Pose2
& rPose1,
const
Pose2
& rPose2)
39
{
40
if
(rPose1 == rPose2)
41
{
42
m_Rotation
.
SetToIdentity
();
43
m_InverseRotation
.
SetToIdentity
();
44
m_Transform
=
Pose2
();
45
return
;
46
}
47
48
// heading transformation
49
m_Rotation
.
FromAxisAngle
(0, 0, 1, rPose2.
GetHeading
() - rPose1.
GetHeading
());
50
m_InverseRotation
.
FromAxisAngle
(0, 0, 1, rPose1.
GetHeading
() - rPose2.
GetHeading
());
51
52
// position transformation
53
Pose2
newPosition;
54
if
(rPose1.
GetX
() != 0.0 || rPose1.
GetY
() != 0.0)
55
{
56
newPosition = rPose2 -
m_Rotation
* rPose1;
57
}
58
else
59
{
60
newPosition = rPose2;
61
}
62
63
m_Transform
=
Pose2
(newPosition.
GetPosition
(), rPose2.
GetHeading
() - rPose1.
GetHeading
());
64
}
65
66
}
karto::Pose2::GetHeading
kt_double GetHeading() const
Definition:
Geometry.h:2274
karto::Transform::m_Transform
Pose2 m_Transform
Definition:
PoseTransform.h:93
karto::Pose2::GetX
kt_double GetX() const
Definition:
Geometry.h:2220
karto::Matrix3::SetToIdentity
void SetToIdentity()
Definition:
Geometry.h:2580
karto::Transform::m_Rotation
Matrix3 m_Rotation
Definition:
PoseTransform.h:95
karto::Pose2::GetPosition
const Vector2d & GetPosition() const
Definition:
Geometry.h:2256
PoseTransform.h
karto::Transform::Transform
Transform()
Definition:
PoseTransform.cpp:23
karto::Transform::SetTransform
void SetTransform(const Pose2 &rPose1, const Pose2 &rPose2)
Definition:
PoseTransform.cpp:38
karto::Transform::m_InverseRotation
Matrix3 m_InverseRotation
Definition:
PoseTransform.h:96
karto::Pose2::GetY
kt_double GetY() const
Definition:
Geometry.h:2238
karto
Definition:
Any.cpp:20
karto::Pose2
Definition:
Geometry.h:2182
karto::Matrix3::FromAxisAngle
void FromAxisAngle(kt_double x, kt_double y, kt_double z, const kt_double radians)
Definition:
Geometry.h:2605
nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:36