Compute a matrix from one or two vectors. At least one and at most two vectors must/can be specified. Parameters: m - filled in with the orienation matrix fvec,uvec,rvec - pointers to vectors that determine the matrix. One or two of these must be specified, with the other(s) set to NULL.
| 643 | // fvec,uvec,rvec - pointers to vectors that determine the matrix. |
| 644 | // One or two of these must be specified, with the other(s) set to NULL. |
| 645 | void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) { |
| 646 | if (!fvec) { // no forward vector. Use up and/or right vectors. |
| 647 | matrix tmatrix; |
| 648 | |
| 649 | if (uvec) { // got up vector. use up and, if specified, right vectors. |
| 650 | DoVectorToMatrix(&tmatrix, uvec, NULL, rvec); |
| 651 | m->fvec = -tmatrix.uvec; |
| 652 | m->uvec = tmatrix.fvec; |
| 653 | m->rvec = tmatrix.rvec; |
| 654 | return; |
| 655 | } else { // no up vector. Use right vector only. |
| 656 | ASSERT(rvec); |
| 657 | DoVectorToMatrix(&tmatrix, rvec, NULL, NULL); |
| 658 | m->fvec = -tmatrix.rvec; |
| 659 | m->uvec = tmatrix.uvec; |
| 660 | m->rvec = tmatrix.fvec; |
| 661 | return; |
| 662 | } |
| 663 | } else { |
| 664 | ASSERT(!(uvec && rvec)); // can only have 1 or 2 vectors specified |
| 665 | DoVectorToMatrix(m, fvec, uvec, rvec); |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | void vm_SinCos(uint16_t a, float *s, float *c) { |
| 670 | if (s) |
no test coverage detected