Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rotation Matrix :45 degrees about point (5,5,0)

80 views
Skip to first unread message

Richard Khaw

unread,
Feb 23, 2004, 1:37:32 PM2/23/04
to
On-line book about AutoCAD VBA, the elements on the matrix states that:
0.707107 -0.707107 0.0 5.0
0.707107 0.707107 0.0 -2.071068
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

I've followed some literature about matrix translation and transformation
and got the following elements:
0.707107 -0.707107 0.0 0.0
0.707107 0.707107 0.0 -7.07107
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

Please suggest me how comes the elements are different and correct my
mistake.

Thanks.
Richard Khaw
Torrance, California.

wivory

unread,
Feb 23, 2004, 8:18:42 PM2/23/04
to
Do you *need* to know the numbers in the matrix? AutoCAD provides the methods GetUCSMatrix and TransformBy for matrix manipulation and the actual values normally wouldn't be of interest. The TranslateCoordinates method is another way to manipulate objects between coordinate systems.

Perhaps if you explain a bit about what you're trying to do we can help more.

Regards

Wayne Ivory
IT Analyst Programmer
Wespine Industries Pty Ltd

Tony Tanzillo

unread,
Feb 24, 2004, 5:25:22 PM2/24/04
to
Not sure what you mean by 'the actual values normally wouldn't be
of interest'. The TransformBy method takes a matrix, and was not
specifically intended to be the matrix returned by GetUCSMatrix,
it can be any matrix that may be composed manually, or obtained via
other means.

Also, TranslateCoordinates doesn't do much for transforming
objects.

--
AcadXTabs: MDI Document Tabs for AutoCAD
http://www.acadxtabs.com

AcadX for AutoCAD 2004 Beta 1
http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip


"wivory" <nos...@address.withheld> wrote in message news:7595385.107758555...@jiveforum1.autodesk.com...

wivory

unread,
Feb 24, 2004, 11:17:36 PM2/24/04
to
True, I realised after I posted that only in some cases would there be an existing object which you could apply a GetUCS method to (I guess I had the blinkers on because that's the way I've used those methods).

The reference to TranslateCoordinates was indicating another possible approach to the bigger picture which may or may not be relevant, hence the request for more information. For example I've created a bunch of objects "relative" to a target object by creating a UCS for it and then "transforming" all the new objects using TranslateCoordinates. Maybe that's unusual - I don't know - I was starting from the ground up at that stage and it produced the desired result.

Regards

Wayne

Jon Fleming

unread,
Feb 26, 2004, 9:39:06 AM2/26/04
to
I haven't looked deeply into AutoCAD's matrix operations; but I think
they're standard.

In standard matrix operations the 3x3 matrix in the upper left corner is the
rotation _around_ _(0,0,0)_, the 1x3 vector at the upper right corner is the
translation after the rotation, and the last row is a dummy to make it come
out right. You do a standard matrix multiplication by a 4x1 coordinate
vector (that is, {X Y Z 1} with the 1 added to make it come out right).

So, your first example rotates 45 degrees around the Z axis and translates
by 5 in the X direction and translates -2.071068 in the Y direction.

You can look at your problem as three different successive problems. I'm
going to round to fewer digits to keep the display cleaner.

1. Translate (5,5,0) to (0,0,0):

1.0 0.0 0.0 -5.0
0.0 1.0 0.0 -5.0


0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

2. Rotate 45 degrees around the Z axis:

0.707 -0.707 0.0 0.0
0.707 0.707 0.0 0.0

0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

3. Translate (0,0,0) back to (5,5,0):

1.0 0.0 0.0 5.0
0.0 1.0 0.0 5.0


0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

Multiplying the first matrix by the second, and then the result by the
third, gives the matrix that rotates 45 degrees around (5,5,0):

0.707 -0.707 0.0 -5.0
0.707 0.707 0.0 2.071

0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

Which is your first matrix except for the signs in the last column. I don't
know why my signs are different from theirs. Maybe that's a non-standard
thing in AutoCAD.

--
jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services

nos...@address.withheld

unread,
Feb 27, 2004, 11:05:31 AM2/27/04
to
Thanks Jon.
I am looking for this kind of explanation.
Richard Khaw
Torrance, CA
0 new messages