Click here to Skip to main content
16,020,114 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionRqst links for Time Complexity Pin
Vijjuuu.19-May-08 21:19
Vijjuuu.19-May-08 21:19 
AnswerRe: Rqst links for Time Complexity Pin
73Zeppelin22-May-08 0:21
73Zeppelin22-May-08 0:21 
GeneralRe: Rqst links for Time Complexity Pin
Vijjuuu.22-May-08 3:43
Vijjuuu.22-May-08 3:43 
GeneralRe: Rqst links for Time Complexity Pin
73Zeppelin22-May-08 19:50
73Zeppelin22-May-08 19:50 
QuestionExtracting shear X&Y from 3x3 affine transformation matrix Pin
Jim Crafton19-May-08 10:27
Jim Crafton19-May-08 10:27 
AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Anthony Mushrow19-May-08 11:08
professionalAnthony Mushrow19-May-08 11:08 
GeneralRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Jim Crafton20-May-08 2:54
Jim Crafton20-May-08 2:54 
GeneralRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Anthony Mushrow20-May-08 3:31
professionalAnthony Mushrow20-May-08 3:31 
I see, so you can get the rotation without worrying about scale or translate etc, because the rotation is completely separate. To get the scale you have to undo the rotation, so you can pretty much just get the values of X and Y here:
X, 0, 0
0, Y, 0
0, 0, 1


Shear and translate are in different parts of the matrix.

The problem is, both shear and translate are affected by Scale, so you'd have to know if the matrix was scaled before or after a shear or translate was applied (if at all).

Rotation isn't affected by scale because the angle remains the same, and the points just get further from the origin. So, the best you can do is to undo the rotation like you have in getScale() and just get the values from the matrix, even thought they may have been scaled.

So, using the apply method (rather than just using the array, i don't know if you have direct access to it):
void Matrix2D::getShear( double& x, double& y ) const
{
	//based on Maxim Shemanarev AGG matrix code ! Thanks !	
	double x1 = 1.0;	
	double y1 = 1.0;	

	Matrix2D rot;	
	rot.rotate( -getRotation() );	
	rot.multiply( *this );	
	rot.apply(x1, y1);	
	x = x1-1;	
	y = y1-1;
}


I think...

My current favourite word is: I'm starting to run out of fav. words!
-SK Genius

Game Programming articles start -here[^]-

AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
73Zeppelin19-May-08 19:21
73Zeppelin19-May-08 19:21 
AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Arash Partow29-May-08 23:37
Arash Partow29-May-08 23:37 
QuestionLong and Int64 Pin
MumbleB15-May-08 20:18
MumbleB15-May-08 20:18 
AnswerRe: Long and Int64 Pin
Ed.Poore15-May-08 21:18
Ed.Poore15-May-08 21:18 
GeneralRe: Long and Int64 Pin
CPallini15-May-08 21:37
mveCPallini15-May-08 21:37 
GeneralRe: Long and Int64 Pin
Ed.Poore15-May-08 21:48
Ed.Poore15-May-08 21:48 
AnswerRe: Long and Int64 Pin
MarkB77715-May-08 21:28
MarkB77715-May-08 21:28 
AnswerRe: Long and Int64 Pin
cp987615-May-08 21:46
cp987615-May-08 21:46 
AnswerRe: Long and Int64 Pin
Mark Churchill18-May-08 4:34
Mark Churchill18-May-08 4:34 
AnswerRe: Long and Int64 Pin
PIEBALDconsult5-Jun-08 8:14
mvePIEBALDconsult5-Jun-08 8:14 
AnswerRe: Long and Int64 Pin
Tadeusz Westawic13-Jun-08 3:28
Tadeusz Westawic13-Jun-08 3:28 
QuestionCounting bricks from image Pin
asiv14-May-08 23:04
asiv14-May-08 23:04 
AnswerRe: Counting bricks from image Pin
Matthew Butler15-May-08 1:34
Matthew Butler15-May-08 1:34 
GeneralRe: Counting bricks from image Pin
asiv15-May-08 2:34
asiv15-May-08 2:34 
GeneralRe: Counting bricks from image Pin
Tim Craig15-May-08 17:31
Tim Craig15-May-08 17:31 
GeneralRe: Counting bricks from image Pin
asiv15-May-08 20:47
asiv15-May-08 20:47 
GeneralRe: Counting bricks from image Pin
MarkB77715-May-08 21:31
MarkB77715-May-08 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.