Visual Basic Customization

Visual Basic Customization

Reply
*Richard Khaw
Message 1 of 6 (455 Views)

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

455 Views, 5 Replies
02-23-2004 10:37 AM
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.
Distinguished Contributor
wivory
Posts: 467
Registered: ‎12-11-2003
Message 2 of 6 (455 Views)

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

02-23-2004 05:18 PM in reply to: *Richard Khaw
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
Message 3 of 6 (455 Views)

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

02-24-2004 02:25 PM in reply to: *Richard Khaw
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
Distinguished Contributor
wivory
Posts: 467
Registered: ‎12-11-2003
Message 4 of 6 (455 Views)

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

02-24-2004 08:17 PM in reply to: *Richard Khaw
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
Message 5 of 6 (455 Views)

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

02-26-2004 06:37 AM in reply to: *Richard Khaw
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.
New Member
rbkhaw2002
Posts: 1
Registered: ‎02-27-2004
Message 6 of 6 (455 Views)

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

02-27-2004 08:05 AM in reply to: *Richard Khaw
Thanks Jon.
I am looking for this kind of explanation.
Richard Khaw
Torrance, CA
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.