Difference between revisions of "Rotation Matrix"

From Microstation VBA Wiki
Jump to: navigation, search
(Created page with 'To rotate cells or text when they are placed, you have to supply a Rotation Matrix. If you don't want any roation you can use the built-in constant Matrix3dIdentity. But …')
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
To rotate [[cells]] or [[text]] when they are placed, you have to supply a Rotation Matrix. If you don't want any roation you can use the built-in constant Matrix3dIdentity. But if you want any rotation you need to come up with one on your own.
+
To rotate [[cells]] or [[text]] when they are placed, you have to supply a Rotation Matrix. If you don't want any rotation you can use the built-in constant Matrix3dIdentity. But if you want any rotation you need to come up with one on your own.
  
 
First you dimension a matrix element:
 
First you dimension a matrix element:
Line 5: Line 5:
 
<PRE>
 
<PRE>
 
Dim oMatrix as Matrix3d
 
Dim oMatrix as Matrix3d
 +
oMatrix = Matrix3dIdentity
 
</PRE>
 
</PRE>
  
Fortunately there is a command that will create a basic rotation matrix given an angle in radians and the axis about which you want to rotate. For 2D drawings, that axis will always be Z which is indicated by the number 2.
+
Fortunately there is a command that will create a basic rotation matrix given the axis about which you want the rotation and an angle in radians. For 2D drawings, that axis will always be Z which is indicated by the number 2.
  
 
<PRE>
 
<PRE>
 
oMatrix = Matrix3dFromAxisAndRotationAngle(2, Radians(180))
 
oMatrix = Matrix3dFromAxisAndRotationAngle(2, Radians(180))
 
</PRE>
 
</PRE>

Latest revision as of 18:20, 6 August 2010

To rotate cells or text when they are placed, you have to supply a Rotation Matrix. If you don't want any rotation you can use the built-in constant Matrix3dIdentity. But if you want any rotation you need to come up with one on your own.

First you dimension a matrix element:

Dim oMatrix as Matrix3d
oMatrix = Matrix3dIdentity

Fortunately there is a command that will create a basic rotation matrix given the axis about which you want the rotation and an angle in radians. For 2D drawings, that axis will always be Z which is indicated by the number 2.

oMatrix = Matrix3dFromAxisAndRotationAngle(2, Radians(180))