How to get the sign of the scale in a 3D transform matrix

How to get the sign of the scale in a 3D transform matrix

Post by Alexandre Bento Freir » Thu, 10 Jan 2002 20:35:29



I using DirectX to render objects modeled in 3DS.
But some objects are mirrors, that means that they have been scaled with negative values.
I need to find such cases. I have the 3D transform matrix (4x3), i know how to get the translation,
but i don't known how to get the scale, all that i need is the sign of the scale, that can be non uniform (x<>y<>z)
Any ideias ?

thanks, in advanced
Alexandre

 
 
 

How to get the sign of the scale in a 3D transform matrix

Post by J Scott Peter XXXIII i/i » Fri, 11 Jan 2002 17:39:16


Find the determinant of the 3x3 non-translation portion of the matrix.
This value is:

   det = (xy*yz - xz*yy)*zx + (xz*yx - xx*yz)*zy + (xx*yy - xy*yx)*zz

I think the determinant of the transpose is the same, so it doesn't matter
whether you address your matrix by rows first or columns first.

The sign of the determinant is the sign of the scale.

 
 
 

How to get the sign of the scale in a 3D transform matrix

Post by Alexandre Bento Freir » Sat, 12 Jan 2002 21:14:50


The problem is that x may be positive and y negative, and z negative.
That is there one scale per axis


Quote:> Find the determinant of the 3x3 non-translation portion of the matrix.
> This value is:

>    det = (xy*yz - xz*yy)*zx + (xz*yx - xx*yz)*zy + (xx*yy - xy*yx)*zz

> I think the determinant of the transpose is the same, so it doesn't matter
> whether you address your matrix by rows first or columns first.

> The sign of the determinant is the sign of the scale.

 
 
 

How to get the sign of the scale in a 3D transform matrix

Post by Folker Schame » Sat, 12 Jan 2002 21:47:46


Quote:> The problem is that x may be positive and y negative, and z negative.

In this case, the object is only rotated by 180 degree around x
and stretched by positive values, without mirroring.

Quote:> That is there one scale per axis

To check if a object is mirrored,
these three individual scales are not relevant.
Only the sign of the determinant.

Greetings,
Folker


Quote:> > Find the determinant of the 3x3 non-translation portion of the matrix.
> > This value is:

> >    det = (xy*yz - xz*yy)*zx + (xz*yx - xx*yz)*zy + (xx*yy - xy*yx)*zz

> > I think the determinant of the transpose is the same, so it doesn't
matter
> > whether you address your matrix by rows first or columns first.

> > The sign of the determinant is the sign of the scale.

 
 
 

How to get the sign of the scale in a 3D transform matrix

Post by Alexandre Bento Freir » Sun, 13 Jan 2002 01:44:05


Thanks, i tried and it worked like charm.


Quote:> Find the determinant of the 3x3 non-translation portion of the matrix.
> This value is:

>    det = (xy*yz - xz*yy)*zx + (xz*yx - xx*yz)*zy + (xx*yy - xy*yx)*zz

> I think the determinant of the transpose is the same, so it doesn't matter
> whether you address your matrix by rows first or columns first.

> The sign of the determinant is the sign of the scale.

 
 
 

How to get the sign of the scale in a 3D transform matrix

Post by Ron Levin » Sun, 13 Jan 2002 04:56:01


On Fri, 11 Jan 2002 12:14:50 -0000, "Alexandre Bento Freire"


>The problem is that x may be positive and y negative, and z negative.
>That is there one scale per axis

Then you are asking a question that has no well defined answer,
unless you are talking about a pure nonuniform scaling with no
rotation at all.   Here's an example that proves it:     Reflection in
the xy plane (i.e., a z scale of -1) concatenated with reflection in
the xz-plane (i.e. a y scale of  -1) produces exactly the same result
as rotation of 180 degrees about the x axis with no reflections at
all.    

Ron


>> Find the determinant of the 3x3 non-translation portion of the matrix.
>> This value is:

>>    det = (xy*yz - xz*yy)*zx + (xz*yx - xx*yz)*zy + (xx*yy - xy*yx)*zz

>> I think the determinant of the transpose is the same, so it doesn't matter
>> whether you address your matrix by rows first or columns first.

>> The sign of the determinant is the sign of the scale.