[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Re:Matrix math (strk)
From: |
strk |
Subject: |
Re: [Gnash-dev] Re:Matrix math (strk) |
Date: |
Wed, 3 Sep 2008 13:10:54 +0200 |
On Tue, Sep 02, 2008 at 11:23:01PM -0700, Mark Voorhies wrote:
> I think that pushing the reflection into sx gives the expected behavior as
> long as the sx != 0 (choosing sx rather than sy is arbitrary).
>
> For the reflection case, atan2 returns the wrong sign (the logic for
> assigning
> quadrants assumes only rotation), so it is still necessary to do the sign
> correction in get_rotation:
>
> E.g.
>
> double
> matrix::get_x_scale() const
> {
> if(determinant() < 0)
> {
> // Capture reflection in x-scale
> return -sqrt(((double)sx * sx + (double)shx * shx)) / 65536.0;
> }
> else
> {
> return sqrt(((double)sx * sx + (double)shx * shx)) / 65536.0;
> }
> }
>
> double
> matrix::get_y_scale() const
> {
> return sqrt(((double)sy * sy + (double)shy * shy)) / 65536.0;
> }
Using sqrt here would make it impossible for Y scale to be negative.
--strk;