Rev | Line | |
---|
[37] | 1 | function q = compose(a,b,c,d) |
---|
| 2 | % Private function to compose a quaternion from four components. |
---|
| 3 | |
---|
| 4 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
| 5 | % See the file : Copyright.m for further details. |
---|
| 6 | |
---|
| 7 | % The rationale for using this function is that it, and the four private |
---|
| 8 | % functions ess(), exe(), wye(), and zed() should be the only functions |
---|
| 9 | % that have knowledge of the underlying representation of a quaternion |
---|
| 10 | % in order to minimise the changes necessary to use a different |
---|
| 11 | % representation. In particular, the class constructor function uses this |
---|
| 12 | % function to make a quaternion, so that even the constructor does not |
---|
| 13 | % know how a quaternion is represented. |
---|
| 14 | |
---|
| 15 | switch nargin |
---|
| 16 | case 3 |
---|
| 17 | q.w = []; q.x = a; q.y = b; q.z = c; |
---|
| 18 | case 4 |
---|
| 19 | q.w = a; q.x = b; q.y = c; q.z = d; |
---|
| 20 | otherwise |
---|
| 21 | error('Internal error in use of private function compose') |
---|
| 22 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.