You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
880 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #include "GMath.h"
  2. #include "CArrayBuffer.h"
  3. #include "CDataView.h"
  4. #include "CFloat32Array.h"
  5. int main() {
  6. GVector3 v1(SQRT(2)/2, SQRT(2) / 2, 0);
  7. GVector3 v2(-1, 1, -1);
  8. GVector3 v3(0, -2, -2);
  9. //˹����������
  10. GVector3 w1 = v1;
  11. GVector3 w2 = v2 - proj(v2, w1); //cout << w2 << endl;
  12. GVector3 w3 = v3 - proj(v3, w1) - proj(v3, w2); //cout << w3 << endl;
  13. //normalize
  14. w1 = w1 / norm(w1);
  15. w2 = w2 / norm(w2);
  16. w3 = w3 / norm(w3);
  17. GMatrix M1(3, 3);
  18. M1.SetRowVec(0, w1);
  19. M1.SetRowVec(1, w2);
  20. M1.SetRowVec(2, w3);
  21. cout << M1 << endl;
  22. GMatrix M2 = Transpose(M1);
  23. cout << M2 << endl;
  24. cout << Det(M1) * Det(M2) << endl;
  25. float a[] = {
  26. 1, 2, 3,
  27. 3, 1, 2,
  28. 2, 3, 1
  29. };
  30. GMatrix M3(3, 3, a);
  31. GMatrix M4 = Inverse(M3);
  32. cout << M3 << endl;
  33. cout << M4 << endl;
  34. cout << Det(M3) * Det(M4) << endl;
  35. return 0;
  36. }