MicrostationJ Basic - Element rotation Matrix

Status
Not open for further replies.

Scott N. Phinney

Usenet Archive
Joined
Jul 12, 2000
Messages
3
Reaction score
0
Anyone understand how the element rotation matrix works.

I can retrieve the matrix just fine with "MbeElement.getRotation", but what you get is a 3X3 rotation matrix.

What do you do with the matrix? How can I convert it to an angle?

I've looked at the on-line help but it's not making any sense to me.

Thanks,
Scott
 
Hi Scott,
Got this tidbit from Dave Preston (thanks Dave) a while back. I haven't tried it, but here it is...

'Here's the function that does all the work:
Function MatrixToAngle (Rotation as Double) as string
Rot11# = rotation(1,1)
Rot12# = rotation(1,2)
Rot21# = rotation(2,1)
Rot22# = rotation(2,2)
If Rot11 = 0 Then
If Rot21 > 0 Then
Atan! = 90
Else
Atan! = -90
End if
Else
'the rad to deg conversion bit:
ATan! = ((atn(Rot21 / Rot11)) * 180) / PI
If rotation(1,1) < 0 Then
ATan! = 180 + Atan
End if
End if
MatrixToAngle = trim$(str$(ATan))
End Function

'this bit would be in your Main sub:
Dim rotation(1 to 3,1 to 3) as Double

... get element here....

Matrix = Elem.getRotation(rotation)
'function is called here:
Angle$ = MatrixToAngle (rotation)

Dave states "The angle is returned in radians, but I have converted it to degrees in the above."

HTH,
Simon

"Scott N. Phinney" wrote:
Anyone understand how the element rotation matrix works.

I can retrieve the matrix just fine with "MbeElement.getRotation", but what you get is a 3X3 rotation matrix.

What do you do with the matrix? How can I convert it to an angle?

I've looked at the on-line help but it's not making any sense to me.

Thanks,
Scott
 
BINGO!

That's it! Thanks!

Scott

"Simon Wurster" wrote:

Hi Scott,
Got this tidbit from Dave Preston (thanks Dave) a while back. I haven't tried it, but here it is...

'Here's the function that does all the work:
Function MatrixToAngle (Rotation as Double) as string
Rot11# = rotation(1,1)
Rot12# = rotation(1,2)
Rot21# = rotation(2,1)
Rot22# = rotation(2,2)
If Rot11 = 0 Then
If Rot21 > 0 Then
...
what
> you get is a 3X3 rotation matrix.
>
> What do you do with the matrix? How can I convert it to an angle?
>
> I've looked at the on-line help but it's not making any sense to me.
>
> Thanks,
> Scott
 
Status
Not open for further replies.

Latest threads

Back
Top