On Wednesday 03 September 2008 09:40:27 Mark Voorhies wrote: > On Wednesday 03 September 2008 04:10:54 strk wrote: > > 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; > > > > Correct. If x_scale and y_scale are both positive then there is no > reflection. If x_scale xor y_scale is negative then there is a reflection > (about the y-axis or x-axis respectively). If both x_scale and y_scale are > negative then there is no net reflection; instead, the reflections about both > axes yield a rotation, which is redundant to the rotation component. > > Since the rotation and translation components _can't_ describe a reflection, > we have to capture it as a negative value in one of the scale components. I > arbitrarily chose x_scale, which should work in all cases except for x_scale > = 0. (x_scale = 0 xor y_scale = 0 will give a zero determinant and collapse > the image to a line. In this case, capturing a reflection as a 180 degree > rotation _will_ work. If both x_scale and y_scale = 0, the image will > collapse to a point and both reflection and rotation become moot). > > --Mark > >
Oops! x_scale = 0 xor y_scale = 0 does not, in general, give a zero determinant. I'm pretty sure the rest of the logic is correct. --Mark _______________________________________________ Gnash-dev mailing list Gnash-dev@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-dev