Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int a,b,c;
- char rotation, rotation_axis;
- float sin, cos;
- float points_array[4] [4] = {{0, 0, 0, 1},
- {0, 0, 0, 1},
- {0, 0, 0, 1},
- {0, 0, 0, 1}};
- float translation_array[4] [4] = {{1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}};
- float x_rotation_array[4] [4] = {{1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}};
- float y_rotation_array[4] [4] = {{1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}};
- float z_rotation_array[4] [4] = {{1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}};
- float scale_array[4] [4] = {{1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}};
- cout << "Please input the four points." << endl;
- cin >> a >> b >> c;
- points_array[0] [0] = a;
- points_array[0] [1] = b;
- points_array[0] [2] = c;
- cin >> a >> b >> c;
- points_array[1] [0] = a;
- points_array[1] [1] = b;
- points_array[1] [2] = c;
- cin >> a >> b >> c;
- points_array[2] [0] = a;
- points_array[2] [1] = b;
- points_array[2] [2] = c;
- cin >> a >> b >> c;
- points_array[3] [0] = a;
- points_array[3] [1] = b;
- points_array[3] [2] = c;
- cout << "Please input the translation in the x, y, and z directions: " << endl;
- cin >> a >> b >> c;
- translation_array[3] [0] = a;
- translation_array[3] [1] = b;
- translation_array[3] [2] = c;
- cout << "Is there a rotation?" << endl;
- cin >> rotation >> sin >> cos;
- switch ( rotation )
- {
- case 'x' :
- x_rotation_array[1] [1] = cos;
- x_rotation_array[1] [2] = sin;
- x_rotation_array[2] [1] = sin - sin*2;
- x_rotation_array[2] [2] = cos;
- case 'y' :
- x_rotation_array[0] [0] = cos;
- x_rotation_array[0] [2] = sin - sin*2;
- x_rotation_array[2] [0] = sin;
- x_rotation_array[2] [2] = cos;
- case 'z' :
- x_rotation_array[0] [0] = cos;
- x_rotation_array[0] [1] = sin;
- x_rotation_array[1] [0] = sin - sin*2;
- x_rotation_array[1] [1] = cos;
- }
- cout << "What are the scale factors for x, y, and z:";
- cin >> a >> b >> c;
- scale_array[0] [0] = a;
- scale_array[1] [1] = b;
- scale_array[2] [2] = c;
- cout << "The four new points are: " << endl;
- // output
- return 0;
- }
- /*
- int [4] [4] printMatrix(points_array);
- {
- for (int i=0; i<4; i++)
- {
- cout << points_array[i] [0] << " " << points_array[i] [1] << " " << points_array[i] [2] << endl;
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement