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
820c1388
Commit
820c1388
authored
5 years ago
by
Raphael Grimm
Browse files
Options
Downloads
Patches
Plain Diff
Improve deg_to_rad and rad_to_deg (they will complain if a non floating type is deduced as return)
parent
cb36f793
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
SimoxUtility/math/convert/deg_to_rad.h
+6
-4
6 additions, 4 deletions
SimoxUtility/math/convert/deg_to_rad.h
SimoxUtility/math/convert/rad_to_deg.h
+4
-2
4 additions, 2 deletions
SimoxUtility/math/convert/rad_to_deg.h
with
10 additions
and
6 deletions
SimoxUtility/math/convert/deg_to_rad.h
+
6
−
4
View file @
820c1388
...
...
@@ -7,14 +7,16 @@
namespace
simox
::
math
{
template
<
class
FloatT
>
FloatT
deg_to_rad
(
FloatT
rad
)
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatT
>
,
FloatT
>
deg_to_rad
(
FloatT
deg
)
{
return
rad
/
180.
f
*
boost
::
math
::
constants
::
pi
<
FloatT
>
();
return
deg
/
180.
f
*
boost
::
math
::
constants
::
pi
<
FloatT
>
();
}
template
<
class
FloatT
>
Eigen
::
Matrix
<
FloatT
,
3
,
1
>
deg_to_rad
(
Eigen
::
Ref
<
const
Eigen
::
Matrix
<
FloatT
,
3
,
1
>>
rad
)
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatT
>
,
Eigen
::
Matrix
<
FloatT
,
3
,
1
>>
deg_to_rad
(
Eigen
::
Ref
<
const
Eigen
::
Matrix
<
FloatT
,
3
,
1
>>
deg
)
{
return
{
deg_to_rad
(
rad
(
0
)),
deg_to_rad
(
rad
(
1
)),
deg_to_rad
(
rad
(
2
))};
return
{
deg_to_rad
(
deg
(
0
)),
deg_to_rad
(
deg
(
1
)),
deg_to_rad
(
deg
(
2
))};
}
}
This diff is collapsed.
Click to expand it.
SimoxUtility/math/convert/rad_to_deg.h
+
4
−
2
View file @
820c1388
...
...
@@ -5,13 +5,15 @@
namespace
simox
::
math
{
template
<
class
FloatT
>
FloatT
rad_to_deg
(
FloatT
rad
)
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatT
>
,
FloatT
>
rad_to_deg
(
FloatT
rad
)
{
return
rad
*
180.
f
/
boost
::
math
::
constants
::
pi
<
FloatT
>
();
}
template
<
class
FloatT
>
Eigen
::
Matrix
<
FloatT
,
3
,
1
>
rad_to_deg
(
Eigen
::
Ref
<
const
Eigen
::
Matrix
<
FloatT
,
3
,
1
>>
rad
)
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatT
>
,
Eigen
::
Matrix
<
FloatT
,
3
,
1
>
>
rad_to_deg
(
Eigen
::
Ref
<
const
Eigen
::
Matrix
<
FloatT
,
3
,
1
>>
rad
)
{
return
{
rad_to_deg
(
rad
(
0
)),
rad_to_deg
(
rad
(
1
)),
rad_to_deg
(
rad
(
2
))};
}
...
...
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