Advertisement
GoldenKela

Hexagon Seal

Oct 27th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. ROTATE_ANGLE = 26;
  2. HAND_COUNT = 29;
  3. HAND_FRACTION = HAND_COUNT / count;
  4. DEG_TO_RAD = pi / 180;
  5. RING_SIZE = 65;
  6. INNER_RING_SIZE = 17;
  7.  
  8. HAND_LENGTH = 110;
  9.  
  10. #7 fractions
  11. #first 5: the star
  12. # next 2: the circle
  13.  
  14. #first part of the star
  15. first_diff = (index + 1) / HAND_COUNT;
  16. is_first_hand = floor(index / HAND_COUNT) == 0;
  17. first_hand_x = (first_diff) * HAND_LENGTH * is_first_hand;
  18. first_hand_y = 0;
  19.  
  20. #second part
  21. second_diff = (index - HAND_COUNT + 1) / HAND_COUNT;
  22. is_second_hand = floor(second_diff) == 0;
  23. second_hand_x = second_diff * HAND_LENGTH * is_second_hand;
  24. second_hand_y = 0;
  25.  
  26.  
  27. #third part
  28. third_diff = (index - HAND_COUNT * 2 + 1) / HAND_COUNT;
  29. is_third_hand = floor(third_diff) == 0;
  30. third_hand_x = third_diff * HAND_LENGTH * is_third_hand;
  31. third_hand_y = 0;
  32.  
  33. #fourth part
  34. fourth_diff = (index - HAND_COUNT * 3 + 1) / HAND_COUNT;
  35. is_fourth_hand = floor(fourth_diff) == 0;
  36. fourth_hand_x = fourth_diff * HAND_LENGTH * is_fourth_hand;
  37. fourth_hand_y = 0;
  38.  
  39. #fifth part
  40. fifth_diff = (index - HAND_COUNT * 4 + 1) / HAND_COUNT;
  41. is_fifth_hand = floor(fifth_diff) == 0;
  42. fifth_hand_x = fifth_diff * HAND_LENGTH * is_fifth_hand;
  43. fifth_hand_y = 0;
  44.  
  45. #sixth part
  46. sixth_diff = (index - HAND_COUNT * 5 + 1) / HAND_COUNT;
  47. is_sixth_hand = floor(sixth_diff) == 0;
  48. sixth_hand_x = sixth_diff * HAND_LENGTH * is_sixth_hand;
  49. sixth_hand_y = 0;
  50.  
  51.  
  52.  
  53. #rotate first hand
  54. cos1 = cos(-60 * DEG_TO_RAD);
  55. sin1 = sin(-60 * DEG_TO_RAD);
  56. x1 = first_hand_x * cos1 - first_hand_y * sin1;
  57. y1 = first_hand_y * cos1 + first_hand_x * sin1;
  58.  
  59. #rotate second hand
  60. cos2 = cos(-120 * DEG_TO_RAD);
  61. sin2 = sin(-120 * DEG_TO_RAD);
  62. x2 = second_hand_x * cos2 - second_hand_y * sin2;
  63. y2 = second_hand_y * cos2 + second_hand_x * sin2;
  64.  
  65. #rotate third hand
  66. sqrt3 = sqrt(3);
  67. sqrt3_length = sqrt(3) * 0.5 * HAND_LENGTH;
  68. one_half = HAND_LENGTH * 0.5;
  69. x3 = third_hand_x - is_third_hand * one_half;
  70. y3 = third_hand_y - is_third_hand * sqrt3_length;
  71.  
  72.  
  73. #just mirror according to the y axis when ur done
  74. #rotate fourth hand
  75. #direct translate
  76. x4 = fourth_hand_x * cos1 - fourth_hand_y * sin1;
  77. y4 = fourth_hand_y * cos1 + fourth_hand_x * sin1;
  78.  
  79. #rotate fifth hand
  80. x5 = fifth_hand_x * cos2 - fifth_hand_y * sin2;
  81. y5 = fifth_hand_y * cos2 + fifth_hand_x * sin2;
  82.  
  83. #sixth hand
  84. x6 = sixth_hand_x - is_sixth_hand * one_half;
  85. y6 = sixth_hand_y - is_sixth_hand * sqrt3_length;
  86.  
  87.  
  88. px = x1 + x2 + x3 + x4 + x5 + x6;
  89. py = y1 + y2 + y3;
  90. ny = y4 + y5 + y6;
  91.  
  92. is_downface = is_fourth_hand | is_fifth_hand | is_sixth_hand;
  93.  
  94. is_ring = index >= HAND_COUNT * 6;
  95. is_star = !is_ring;
  96. ring_f = (index - HAND_COUNT * 6) / (count - HAND_COUNT * 6)
  97. sub_index = index % 2;
  98. actual_ring_size = (RING_SIZE - sub_index * INNER_RING_SIZE);
  99. ring_x = sin(ring_f * tau) * is_ring * actual_ring_size;
  100. ring_y = cos(ring_f * tau) * is_ring * actual_ring_size;
  101.  
  102. star_x = px;
  103. star_y = py - ny - is_downface * HAND_LENGTH * sqrt3 * 2 / 3 + is_star * HAND_LENGTH / sqrt(3);
  104.  
  105. cos_time = cos(time * 0.5);
  106. sin_time = sin(time * 0.5);
  107.  
  108. ssx = star_x * cos_time - star_y * sin_time;
  109. ssy = star_y * cos_time + star_x * sin_time;
  110.  
  111. rsx = ring_x * cos_time + ring_y * sin_time;
  112. rsy = ring_y * cos_time - ring_x * sin_time;
  113.  
  114. x' = ssx + rsx;
  115. y' = ssy + rsy;
  116.  
  117. h = 0;
  118. s = 0;
  119. v = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement