diff --git a/.vs/3dMath/v15/.suo b/.vs/3dMath/v15/.suo index 814dadc..07efb70 100644 Binary files a/.vs/3dMath/v15/.suo and b/.vs/3dMath/v15/.suo differ diff --git a/main.cpp b/main.cpp index 6f0a7bb..30436e0 100644 --- a/main.cpp +++ b/main.cpp @@ -5,75 +5,13 @@ int main() { - printf("arr0 内部生成CArrayBuffer\n"); - CFloat32Array arr0(8); - for (int i = 0; i < arr0.length(); i++) { - arr0[i] = i * 100.0; - } - for (int i = 0; i < arr0.length(); i++) { - printf("%f\n", arr0[i]); - } + GVector3 v1(SQRT(2)/2, SQRT(2) / 2, 0); + GVector3 v2(-1, 1, -1); + GVector3 v3(0, -2, -2); - printf("arr1 共享 arr0 中 CArrayBuffer 的部分区块\n"); - CFloat32Array arr1(arr0.buffer, 4 * sizeof(float32), 4); - for (int i = 0; i < arr1.length(); i++) { - printf("%f\n", arr1[i]); - } - - printf("重置arr1的各个元素为10.0的倍数\n"); - for (int i = 0; i < arr1.length(); i++) { - arr1[i] = i * 10.0; - } - for (int i = 0; i < arr1.length(); i++) { - printf("%f\n", arr1[i]); - } - - /*GVector l(3); - l += 2; - cout << l*3 << endl; - - float a[] = { - 2, -1, 3, - 4, -2, 5, - 6, -3, 8 - }; - GMatrix A(3, 3, a); - - float b[] = { - 2, -1, 9, - 2, -2, 5, - 3, 1, 2 - }; - GMatrix B(3, 3, b); - - GMatrix C = A*B; - - cout << A << endl; - cout << B << endl; - cout << C << endl; - - GVector ret(3); - GVector rv = B.GetColVec(1); - for (int i = 0; i < A.GetColNum(); i++) { - GVector l = A.GetColVec(i); - ret += rv[i]*l; - } - - cout << ret << endl; - */ - /*float a[] = { - 1,0, - 1,4 - }; - GMatrix A(2, 2, a); - - float c[] = { - 0,1, - 1,0 - }; - GMatrix C(2, 2, c); - - cout << A*A << endl;*/ + GVector3 w1 = v1; + GVector3 w2 = v2 - proj(v2, w1); //cout << w2 << endl; + GVector3 w3 = v3 - proj(v3, w1) - proj(v3, w2); //cout << w3 << endl; return 0; } \ No newline at end of file