Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5.  
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11. int a,b,c;
  12. char rotation, rotation_axis;
  13. float sin, cos;
  14. float points_array[4] [4] = {{0, 0, 0, 1},
  15. {0, 0, 0, 1},
  16. {0, 0, 0, 1},
  17. {0, 0, 0, 1}};
  18.  
  19. float translation_array[4] [4] = {{1, 0, 0, 0},
  20. {0, 1, 0, 0},
  21. {0, 0, 1, 0},
  22. {0, 0, 0, 1}};
  23.  
  24. float x_rotation_array[4] [4] = {{1, 0, 0, 0},
  25. {0, 1, 0, 0},
  26. {0, 0, 1, 0},
  27. {0, 0, 0, 1}};
  28.  
  29. float y_rotation_array[4] [4] = {{1, 0, 0, 0},
  30. {0, 1, 0, 0},
  31. {0, 0, 1, 0},
  32. {0, 0, 0, 1}};
  33.  
  34. float z_rotation_array[4] [4] = {{1, 0, 0, 0},
  35. {0, 1, 0, 0},
  36. {0, 0, 1, 0},
  37. {0, 0, 0, 1}};
  38.  
  39. float scale_array[4] [4] = {{1, 0, 0, 0},
  40. {0, 1, 0, 0},
  41. {0, 0, 1, 0},
  42. {0, 0, 0, 1}};
  43.  
  44.  
  45. cout << "Please input the four points." << endl;
  46. cin >> a >> b >> c;
  47. points_array[0] [0] = a;
  48. points_array[0] [1] = b;
  49. points_array[0] [2] = c;
  50. cin >> a >> b >> c;
  51. points_array[1] [0] = a;
  52. points_array[1] [1] = b;
  53. points_array[1] [2] = c;
  54. cin >> a >> b >> c;
  55. points_array[2] [0] = a;
  56. points_array[2] [1] = b;
  57. points_array[2] [2] = c;
  58. cin >> a >> b >> c;
  59. points_array[3] [0] = a;
  60. points_array[3] [1] = b;
  61. points_array[3] [2] = c;
  62.  
  63.  
  64.  
  65. cout << "Please input the translation in the x, y, and z directions: " << endl;
  66. cin >> a >> b >> c;
  67. translation_array[3] [0] = a;
  68. translation_array[3] [1] = b;
  69. translation_array[3] [2] = c;
  70.  
  71.  
  72. cout << "Is there a rotation?" << endl;
  73. cin >> rotation >> sin >> cos;
  74.  
  75. switch ( rotation )
  76. {
  77. case 'x' :
  78. x_rotation_array[1] [1] = cos;
  79. x_rotation_array[1] [2] = sin;
  80. x_rotation_array[2] [1] = sin - sin*2;
  81. x_rotation_array[2] [2] = cos;
  82.  
  83. case 'y' :
  84. x_rotation_array[0] [0] = cos;
  85. x_rotation_array[0] [2] = sin - sin*2;
  86. x_rotation_array[2] [0] = sin;
  87. x_rotation_array[2] [2] = cos;
  88.  
  89. case 'z' :
  90. x_rotation_array[0] [0] = cos;
  91. x_rotation_array[0] [1] = sin;
  92. x_rotation_array[1] [0] = sin - sin*2;
  93. x_rotation_array[1] [1] = cos;
  94. }
  95.  
  96.  
  97. cout << "What are the scale factors for x, y, and z:";
  98. cin >> a >> b >> c;
  99. scale_array[0] [0] = a;
  100. scale_array[1] [1] = b;
  101. scale_array[2] [2] = c;
  102.  
  103.  
  104. cout << "The four new points are: " << endl;
  105. // output
  106.  
  107.  
  108.  
  109.  
  110. return 0;
  111. }
  112.  
  113.  
  114.  
  115. /*
  116. int [4] [4] printMatrix(points_array);
  117. {
  118. for (int i=0; i<4; i++)
  119. {
  120. cout << points_array[i] [0] << " " << points_array[i] [1] << " " << points_array[i] [2] << endl;
  121. }
  122. }
  123. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement