From: HellenicOne on
I am looking at several drawing applications and noticed the
following:

I draw 4 rectangles on the screen with 0 (Rect1), 90 (Rect2), 180
(Rect3), and 270 (Rect4) degrees of rotation respectively. I then
select all 4 rectangles and proceed to resize the bottom side of Rect1
along the Y axis by +5 pixels.

I immediately notice that rectangles 2, 3, and 4 are also resizing
along the Y axis regardless of rotation. Does anyone know how this is
accomplished?

My rectangles are expressed as follows:

POINT PointA[0]; //Top left point
POINT PointB[1]; //Bottom right point
POINT Centre; //Centre point of shape
double Rotation; //Shape rotation


Currently the way my application is working is I unrotate the mouse
origin and current mouse point to determine an offset xy value.
Depending on the resize handle the mouse is over I apply the offset to
my rectangle structure.

In the above example if I am resizing Rect1 by +5 pixels along the Y
axis I simply express this as:

Rectangle->PointB[1].y += OffsetY;

However, if I do the same to Rect2 which is rotated at 90 degrees the
resize is not in the same direction since it is rotated by 90 degrees,
it will appear to be resizing alone the -X axis.

My question is, how can I transform (resize) all rectangles so they
appear to be resizing in the same direction (Up/Down/Left/Right)
regardless of the rotation of the rectangle?


Thanks
 | 
Pages: 1
Prev: clip board logger
Next: GetLogicalDriveStrings