Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to obtain angle between axes from two frames

Genius
Genius

The calculation of the angle between vectors just replace with originalZAxisVector.GetAngle(targetZAxisVector).

Why reinvent the wheel.

Witalij

Re: How to obtain angle between axes from two frames

Genius
Genius

Sorry, I have forget to subtract the origin of the both frames. the function will look like this:

Public Function getZAxisAngle(frame1 As TxFrame, frame2 As TxFrame) As Double
        Dim zAxisVector As New TxVector(0R, 0R, 1.0R)
        Dim originalZAxisVector As TxVector = frame1.AbsoluteLocation.Transform(zAxisVector) - frame1.AbsoluteLocation.Translation
        Dim targetZAxisVector As TxVector = frame2.AbsoluteLocation.Transform(zAxisVector) - frame2.AbsoluteLocation.Translation
        Return originalZAxisVector.GetAngle(targetZAxisVector)
    End Function