VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
703 Views, 5 Replies

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

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.
5 REPLIES 5
Message 2 of 6
wivory
in reply to: Anonymous

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
Message 3 of 6
Anonymous
in reply to: Anonymous

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" wrote in message news:7595385.1077585554813.JavaMail.jive@jiveforum1.autodesk.com... > 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
Message 4 of 6
wivory
in reply to: Anonymous

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
Message 5 of 6
Anonymous
in reply to: Anonymous

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 In article <403a4891$1_3@newsprd01>, Richard Khaw wrote: > 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.
Message 6 of 6
rbkhaw2002
in reply to: Anonymous

Thanks Jon.
I am looking for this kind of explanation.
Richard Khaw
Torrance, CA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost