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.
| 685 | // fvec,uvec,rvec - pointers to vectors that determine the matrix. |
| 686 | // One or two of these must be specified, with the other(s) set to NULL. |
| 687 | void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) { |
| 688 | if (!fvec) { // no forward vector. Use up and/or right vectors. |
| 689 | matrix tmatrix; |
| 690 | |
| 691 | if (uvec) { // got up vector. use up and, if specified, right vectors. |
| 692 | DoVectorToMatrix(&tmatrix, uvec, NULL, rvec); |
| 693 | m->fvec = -tmatrix.uvec; |
| 694 | m->uvec = tmatrix.fvec; |
| 695 | m->rvec = tmatrix.rvec; |
| 696 | return; |
| 697 | } else { // no up vector. Use right vector only. |
| 698 | // ASSERT(rvec); |
| 699 | DoVectorToMatrix(&tmatrix, rvec, NULL, NULL); |
| 700 | m->fvec = -tmatrix.rvec; |
| 701 | m->uvec = tmatrix.uvec; |
| 702 | m->rvec = tmatrix.fvec; |
| 703 | return; |
| 704 | } |
| 705 | } else { |
| 706 | // ASSERT(! (uvec && rvec)); //can only have 1 or 2 vectors specified |
| 707 | DoVectorToMatrix(m, fvec, uvec, rvec); |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | void vm_SinCos(uint16_t a, float *s, float *c) { |
| 712 | if (s) |
no test coverage detected