Re: [eigen] get scaling out of transform? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] get scaling out of transform?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 21 Jan 2009 21:22:44 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=cWW8ehbt0+22kaViCPEmmnQtKdEHGHKnBcX/joZRH18=; b=dMtynMIYIlyP+1ZQwf5J6RsV2ZGhuE3iGN1TNhAKIzuuPV678PV8LeaAKV0zssgZC2 y3e20OJJuZB2zgWsbRXCiYzVMM6VdgaFaqXgEnPW+Q1xbYKMC9JSyxDLEitSXLO4xky5 Ospc25FfcmAG0miUnBXeFAxxILas1/jQdoWC4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=kY57Yi5uBkDe4lS42fe3+jMxikNtGV9D43nngCLK3LfZdU1MHjFrMy4v1jjzMgtPxD 4eLI74Sa3VfRwCvVHho4KlgO+1W6icKGLOtxghTVjwu5/oLLLlMEXbhiasXJdi2wW8WH 3hCrQOfj9aFclKzXcMZUITV+pac6B6T2tKOg4=
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
>