Advertisement
GoldenKela

Pentagon Seal

Oct 27th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 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 = 125;
  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(first_diff) == 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.  
  46. #rotate first hand
  47. cos1 = cos(-72 * DEG_TO_RAD);
  48. sin1 = sin(-72 * DEG_TO_RAD);
  49. x1 = first_hand_x * cos1 - first_hand_y * sin1;
  50. y1 = first_hand_y * cos1 + first_hand_x * sin1;
  51.  
  52. #rotate second hand
  53. cos2 = cos(144 * DEG_TO_RAD);
  54. sin2 = sin(144 * DEG_TO_RAD);
  55. #compute offset
  56. cos18 = cos(18 * DEG_TO_RAD) * HAND_LENGTH;
  57. sin18 = sin(18 * DEG_TO_RAD) * HAND_LENGTH;
  58.  
  59. #offset in the x direction by sin18 * length
  60. #offset in y by cos18 * length
  61. x2 = second_hand_x * cos2 - second_hand_y * sin2 + sin18 * is_second_hand;
  62. y2 = second_hand_y * cos2 + second_hand_x * sin2 - cos18 * is_second_hand;
  63.  
  64. #rotate third hand
  65. half_hand = HAND_LENGTH / 2;
  66. tan36 = tan(36 * DEG_TO_RAD);
  67. x3 = third_hand_x - is_third_hand * half_hand;
  68. y3 = third_hand_y - is_third_hand * half_hand * tan36;
  69.  
  70.  
  71. #just mirror according to the x axis when ur done
  72. #rotate fourth hand
  73. #direct translate
  74. x4 = fourth_hand_x * cos1 - fourth_hand_y * sin1;
  75. y4 = fourth_hand_y * cos1 + fourth_hand_x * sin1;
  76.  
  77. #rotate fifth hand
  78. x5 = fifth_hand_x * cos2 - fifth_hand_y * sin2 + sin18 * is_fifth_hand;
  79. y5 = fifth_hand_y * cos2 + fifth_hand_x * sin2 - cos18 * is_fifth_hand;
  80.  
  81.  
  82. px = x1 + x2 + x3 - x4 - x5;
  83. py = y1 + y2 + y3 + y4 + y5;
  84.  
  85. is_downface = is_fourth_hand | is_fifth_hand;
  86.  
  87. is_ring = index >= HAND_COUNT * 6;
  88. is_star = !is_ring;
  89. ring_f = (index - HAND_COUNT * 6) / (count - HAND_COUNT * 6)
  90. sub_index = index % 2;
  91. actual_ring_size = (RING_SIZE - sub_index * INNER_RING_SIZE);
  92. ring_x = sin(ring_f * tau) * is_ring * actual_ring_size;
  93. ring_y = cos(ring_f * tau) * is_ring * actual_ring_size;
  94.  
  95. star_x = px;
  96. star_offset = is_star * (HAND_LENGTH * 0.5) / cos(18 * DEG_TO_RAD);
  97. star_y = py + star_offset;
  98.  
  99. cos_time = cos(time * 0.5);
  100. sin_time = sin(time * 0.5);
  101.  
  102. ssx = star_x * cos_time - star_y * sin_time;
  103. ssy = star_y * cos_time + star_x * sin_time;
  104.  
  105. rsx = ring_x * cos_time + ring_y * sin_time;
  106. rsy = ring_y * cos_time - ring_x * sin_time;
  107.  
  108. x' = ssx + rsx;
  109. y' = ssy + rsy;
  110.  
  111. h = 0;
  112. s = 0;
  113. v = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement