Re: [eigen] get scaling out of transform?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


There's another way that you can go, suffering again performance-wise
from the current lack of fixed-size specializations: use the
SelfAdjointEigenSolver.

Transform3d t;
Matrix3d m = t.linear();
SelfAdjointEigenSolver s(m*m.adjoint());
Matrix3d scaling = s.operatorSqrt();

Or if you just want the scaling amplitude, not its geometric
orientation, you just need:

Vector3d scalingAmplitude = s.eigenvalues().cwise().sqrt();

that requires both the QR and the Array modules.

Cheers
Benoit

2009/1/21 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> This is currently unimplemented in Transform, and the computation
> involved is really nontrivial.
>
> It is definitely on my TODO for 2.1.
>
> Here's an explanation. When you decompose a matrix as a product
> rotation*scaling, that's called the "polar decomposition". Computing
> the polar decomposition amounts to computing the SVD decomposition. In
> Eigen 2.1 we'll have a very good SVD with fixed-size specializations
> and I'll use that to implement scaling() and reimplement rotation()
> correctly in Transform.
>
> Meanwhile, if you don't care about performance, you can already use
> the SVD in Eigen 2.0 but it's slow if only for lack of fixed-size
> specializations.
>
> If the SVD of M is M = U D V^      (where ^ denotes adjoint, or
> transpose for real matrices)
> then you have M = U D U^  U V^
> So your scaling is U D U^
> and your rotation is U V^
>
> Cheers,
> Benoit
>
> 2009/1/21 Ben Axelrod <baxelrod@xxxxxxxxxxxx>:
>> Hi,
>>
>>
>>
>> How can I get the scaling info out of the Transform class?
>>
>>
>>
>> Thanks,
>>
>> -Ben
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/