Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Saurel
eigenpy
Commits
9e4b7921
Unverified
Commit
9e4b7921
authored
3 years ago
by
Justin Carpentier
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #271 from jcarpent/devel
Fix memory issue with Quaternion::normalized
parents
63385108
c17d8702
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/eigenpy/quaternion.hpp
+12
-4
12 additions, 4 deletions
include/eigenpy/quaternion.hpp
src/quaternion.cpp
+5
-2
5 additions, 2 deletions
src/quaternion.cpp
with
17 additions
and
6 deletions
include/eigenpy/quaternion.hpp
+
12
−
4
View file @
9e4b7921
...
...
@@ -185,16 +185,19 @@ namespace eigenpy
"Returns the quaternion describing the inverse rotation."
)
.
def
(
"setIdentity"
,
&
Quaternion
::
setIdentity
,
bp
::
arg
(
"self"
),
"Set *this to the idendity rotation."
,
bp
::
return_self
<>
())
"Set *this to the identity rotation."
,
bp
::
return_self
<>
())
.
def
(
"norm"
,
&
Quaternion
::
norm
,
bp
::
arg
(
"self"
),
"Returns the norm of the quaternion's coefficients."
)
.
def
(
"normalize"
,
&
Quaternion
::
normalize
,
bp
::
arg
(
"self"
),
"Normalizes the quaternion *this."
)
.
def
(
"normalized"
,
&
Quaternion
::
normalized
,
"Normalizes the quaternion *this."
,
bp
::
return_self
<>
())
.
def
(
"normalized"
,
&
normalized
,
bp
::
arg
(
"self"
),
"Returns a normalized copy of *this."
)
"Returns a normalized copy of *this."
,
bp
::
return_value_policy
<
bp
::
manage_new_object
>
())
.
def
(
"squaredNorm"
,
&
Quaternion
::
squaredNorm
,
bp
::
arg
(
"self"
),
"Returns the squared norm of the quaternion's coefficients."
)
...
...
@@ -251,6 +254,11 @@ namespace eigenpy
;
}
private
:
static
Quaternion
*
normalized
(
const
Quaternion
&
self
)
{
return
new
Quaternion
(
self
.
normalized
());
}
template
<
int
i
>
static
void
setCoeff
(
Quaternion
&
self
,
Scalar
value
)
{
self
.
coeffs
()[
i
]
=
value
;
}
...
...
This diff is collapsed.
Click to expand it.
src/quaternion.cpp
+
5
−
2
View file @
9e4b7921
/*
* Copyright 2014-2019, CNRS
* Copyright 2018-20
19
, INRIA
* Copyright 2018-20
22
, INRIA
*/
#include
"eigenpy/memory.hpp"
#include
"eigenpy/geometry.hpp"
#include
"eigenpy/quaternion.hpp"
#include
<Eigen/Geometry>
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
Eigen
::
Quaterniond
)
#include
"eigenpy/quaternion.hpp"
namespace
eigenpy
{
void
exposeQuaternion
()
...
...
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