# bug #55782: [octave forge] (quaternion) q2rotm: function to convert quaternion to rotation matrix

 Submitted by: Rick T Submitted on: Mon 25 Feb 2019 11:23:34 PM UTC Category: Octave Forge Package Severity: 1 - Wish Priority: 3 - Low Item Group: Feature Request Status: None Assigned to: None Originator Name: Open/Closed: Open Release: other Operating System: GNU/Linux

You are not logged in

## Discussion

Mon 25 Feb 2019 11:23:34 PM UTC, original submission:

Requesting that a function to convert quaternion to matrix be added. There is a matrix to quaternion (rotm2q.m) but not the other way around.

Some example code like this could be added:

function [Rt]=q2rotm(qt)

s=qt(1);
vx=qt(2);
vy=qt(3);
vz=qt(4);

i1j1=1-2*vy^2-2*vz^2;
i1j2=2*vx*vy-2*s*vz;
i1j3=2*vx*vz+2*s*vy;
i2j1=2*vx*vy+2*s*vz;
i2j2=1-2*vx^2-2*vz^2;
i2j3=2*vy*vz-2*s*vx;
i3j1=2*vx*vz-2*s*vy;
i3j2=2*vy*vz+2*s*vx;
i3j3=1-2*vx^2-2*vy^2;

Rt=[i1j1 i1j2 i1j3;i2j1 i2j2 i2j3;i3j1 i3j2 i3j3];

Rick T <ratulloch>

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by ratulloch (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.