mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-25 15:53:19 +08:00
slight change in the comparison to -1
This commit is contained in:
parent
f84bd3e7b1
commit
629e083d81
@ -368,7 +368,7 @@ inline Quaternion<Scalar>& Quaternion<Scalar>::setFromTwoVectors(const MatrixBas
|
|||||||
// under the constraint:
|
// under the constraint:
|
||||||
// ||x|| = 1
|
// ||x|| = 1
|
||||||
// which yields a singular value problem
|
// which yields a singular value problem
|
||||||
if (ei_isApprox(c,Scalar(-1)))
|
if (c < Scalar(-1)+precision<Scalar>())
|
||||||
{
|
{
|
||||||
c = std::max<Scalar>(c,-1);
|
c = std::max<Scalar>(c,-1);
|
||||||
Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
|
Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
|
||||||
@ -378,10 +378,8 @@ inline Quaternion<Scalar>& Quaternion<Scalar>::setFromTwoVectors(const MatrixBas
|
|||||||
Scalar w2 = (Scalar(1)+c)*Scalar(0.5);
|
Scalar w2 = (Scalar(1)+c)*Scalar(0.5);
|
||||||
this->w() = ei_sqrt(w2);
|
this->w() = ei_sqrt(w2);
|
||||||
this->vec() = axis * ei_sqrt(Scalar(1) - w2);
|
this->vec() = axis * ei_sqrt(Scalar(1) - w2);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 axis = v0.cross(v1);
|
Vector3 axis = v0.cross(v1);
|
||||||
Scalar s = ei_sqrt((Scalar(1)+c)*Scalar(2));
|
Scalar s = ei_sqrt((Scalar(1)+c)*Scalar(2));
|
||||||
Scalar invs = Scalar(1)/s;
|
Scalar invs = Scalar(1)/s;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This file is part of Eigen, a lightweight C++ template library
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
// for linear algebra.
|
// for linear algebra.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
|
||||||
//
|
//
|
||||||
// Eigen is free software; you can redistribute it and/or
|
// Eigen is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
Loading…
x
Reference in New Issue
Block a user