Skip to content
Snippets Groups Projects
Unverified Commit 9e4b7921 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

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
......@@ -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; }
......
/*
* Copyright 2014-2019, CNRS
* Copyright 2018-2019, INRIA
* Copyright 2018-2022, 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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment