Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
3bd3e0c9
Commit
3bd3e0c9
authored
6 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Added invertPose/invertedPose
parent
6f89bebd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
VirtualRobot/math/Helpers.cpp
+4
-0
4 additions, 0 deletions
VirtualRobot/math/Helpers.cpp
VirtualRobot/math/Helpers.h
+17
-0
17 additions, 0 deletions
VirtualRobot/math/Helpers.h
with
21 additions
and
0 deletions
VirtualRobot/math/Helpers.cpp
+
4
−
0
View file @
3bd3e0c9
...
...
@@ -258,6 +258,10 @@ Eigen::Matrix3f Helpers::GetOrientation(const Eigen::Matrix4f& pose)
return
oriBlock
(
pose
);
}
void
Helpers
::
InvertPose
(
Eigen
::
Matrix4f
&
pose
)
{
oriBlock
(
pose
).
transposeInPlace
();
posBlock
(
pose
)
=
-
oriBlock
(
pose
)
*
posBlock
(
pose
);
}
Eigen
::
VectorXf
Helpers
::
LimitVectorLength
(
const
Eigen
::
VectorXf
&
vec
,
const
Eigen
::
VectorXf
&
maxLen
)
...
...
This diff is collapsed.
Click to expand it.
VirtualRobot/math/Helpers.h
+
17
−
0
View file @
3bd3e0c9
...
...
@@ -62,6 +62,12 @@ namespace math
static
Eigen
::
Vector3f
CreateVectorFromCylinderCoords
(
float
r
,
float
angle
,
float
z
);
static
Eigen
::
Matrix4f
TranslatePose
(
const
Eigen
::
Matrix4f
&
pose
,
const
Eigen
::
Vector3f
&
offset
);
/// Invert the given pose in-place.
static
void
InvertPose
(
Eigen
::
Matrix4f
&
pose
);
/// Return the inverted of the given pose.
template
<
typename
Derived
>
static
Eigen
::
Matrix4f
InvertedPose
(
const
Eigen
::
MatrixBase
<
Derived
>&
pose
);
static
Eigen
::
Vector3f
TransformPosition
(
const
Eigen
::
Matrix4f
&
transform
,
const
Eigen
::
Vector3f
&
pos
);
static
Eigen
::
Vector3f
TransformDirection
(
const
Eigen
::
Matrix4f
&
transform
,
const
Eigen
::
Vector3f
&
dir
);
static
Eigen
::
Matrix3f
TransformOrientation
(
const
Eigen
::
Matrix4f
&
transform
,
const
Eigen
::
Matrix3f
&
ori
);
...
...
@@ -69,7 +75,9 @@ namespace math
static
Eigen
::
Vector3f
GetPosition
(
const
Eigen
::
Matrix4f
&
pose
);
static
Eigen
::
Matrix3f
GetOrientation
(
const
Eigen
::
Matrix4f
&
pose
);
static
Eigen
::
VectorXf
LimitVectorLength
(
const
Eigen
::
VectorXf
&
vec
,
const
Eigen
::
VectorXf
&
maxLen
);
static
float
rad2deg
(
float
rad
);
static
float
deg2rad
(
float
deg
);
...
...
@@ -160,5 +168,14 @@ namespace math
return
toPose
(
pos
,
ori
.
toRotationMatrix
());
}
template
<
typename
Derived
>
Eigen
::
Matrix4f
Helpers
::
InvertedPose
(
const
Eigen
::
MatrixBase
<
Derived
>&
pose
)
{
Eigen
::
Matrix4f
inv
=
pose
;
InvertPose
(
inv
);
return
inv
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment