Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.93 KB | None | 0 0
  1. #!/usr/bin/env sh
  2.  
  3. # Proof of concept ISSF (International Shooting Sport Federation, incl. Olympia) 10m air rifle target with ImageMagick and bc.
  4. # Dimensions not verified. Not printed yet, tested only on screen.
  5. #
  6. # http://www.issf-sports.org/documents/rules/2017/ISSFRuleBook2017-2ndPrintV1.1-ENG.zip
  7. # 6.3.4.3 - 10m Air Rifle Target
  8. #
  9. #10 Ring 0.5 mm (±0.1 mm)
  10. # 9 Ring 5.5 mm (±0.1 mm)
  11. # 8 Ring 10.5 mm (±0.1 mm)
  12. # 7 Ring 15.5 mm (±0.1 mm)
  13. # 6 Ring 20.5 mm (±0.1 mm)
  14. # 5 Ring 25.5 mm (±0.1 mm)
  15. # 4 Ring 30.5 mm (±0.1 mm)
  16. # 3 Ring 35.5 mm (±0.1 mm)
  17. # 2 Ring 40.5 mm (±0.1 mm)
  18. # 1 Ring 45.5 mm (±0.1 mm)
  19. #Inner Ten: When the 10 ring (dot) has been shot out completely as determined
  20. # by the use of an Air Pistol OUTWARD scoring gauge.
  21. #Black from 4 to 9 rings = 30.5 mm (±0.1 mm).
  22. #The ten ring is a white dot = 0.5 mm (±0.1 mm).
  23. #Ring thickness: 0.1 mm to 0.2 mm.
  24. #Minimum visible size of target card: 80 mm x 80 mm.
  25. #Scoring ring values 1 – 8 are printed in the scoring zones in vertical and horizontal
  26. # lines, at right angles to each other. The 9 point zone is not marked with a number.
  27. #The 10 is a white dot.
  28. #Background cards 170 mm x 170 mm, similar in color to the target material should
  29. # be provided to improve the visibility of the target.
  30. #
  31. # 6.4.6.1 - Height of Target Centers
  32. # 1.40 m (±0.05 m)
  33. #
  34. # https://en.wikipedia.org/wiki/ISSF_10_meter_air_rifle
  35.  
  36. ## Target card size in mm
  37. DPI=96
  38. WIDTH=140
  39. HEIGHT=140
  40.  
  41. a=$(echo "$DPI * $WIDTH / 25.4" | bc -l)
  42. b=$(echo "$DPI * $HEIGHT / 25.4" | bc -l)
  43. ahalf=$(echo "$a/2" | bc -l)
  44. bhalf=$(echo "$b/2" | bc -l)
  45. # Ring thickness
  46. rt=$(echo "$DPI * 0.15 / 25.4" | bc -l)
  47.  
  48. one=$(echo "$DPI * 45.5 / 25.4" | bc -l)
  49. n1=$(echo "$one - ($DPI * 2.5 / 25.4)" | bc -l)
  50. c1=$(echo "$bhalf + $one" | bc -l)
  51.  
  52. two=$(echo "$DPI * 40.5 / 25.4" | bc -l)
  53. n2=$(echo "$two - ($DPI * 2.5 / 25.4)" | bc -l)
  54. c2=$(echo "$bhalf + $two" | bc -l)
  55.  
  56. three=$(echo "$DPI * 35.5 / 25.4" | bc -l)
  57. n3=$(echo "$three - ($DPI * 2.5 / 25.4)" | bc -l)
  58. c3=$(echo "$bhalf + $three" | bc -l)
  59.  
  60. four=$(echo "$DPI * 30.5 / 25.4" | bc -l)
  61. n4=$(echo "$four - ($DPI * 2.5 / 25.4)" | bc -l)
  62. c4=$(echo "$bhalf + $four" | bc -l)
  63.  
  64. five=$(echo "$DPI * 25.5 / 25.4" | bc -l)
  65. n5=$(echo "$five - ($DPI * 2.5 / 25.4)" | bc -l)
  66. c5=$(echo "$bhalf + $five" | bc -l)
  67.  
  68. six=$(echo "$DPI * 20.5 / 25.4" | bc -l)
  69. n6=$(echo "$six - ($DPI * 2.5 / 25.4)" | bc -l)
  70. c6=$(echo "$bhalf + $six" | bc -l)
  71.  
  72. seven=$(echo "$DPI * 15.5 / 25.4" | bc -l)
  73. n7=$(echo "$seven - ($DPI * 2.5 / 25.4)" | bc -l)
  74. c7=$(echo "$bhalf + $seven" | bc -l)
  75.  
  76. eight=$(echo "$DPI * 10.5 / 25.4" | bc -l)
  77. n8=$(echo "$eight - ($DPI * 2.5 / 25.4)" | bc -l)
  78. c8=$(echo "$bhalf + $eight" | bc -l)
  79.  
  80. nine=$(echo "$DPI * 5.5 / 25.4" | bc -l)
  81. #n9=$(echo "$nine - ($DPI * 2.5 / 25.4)" | bc -l)
  82. c9=$(echo "$bhalf + $nine" | bc -l)
  83.  
  84. ten=$(echo "$DPI * 0.5 / 25.4" | bc -l)
  85. #n10=$(echo "$nine - ($DPI * 2.5 / 25.4)" | bc -l)
  86. c10=$(echo "$bhalf + $ten" | bc -l)
  87.  
  88. ## 'One-Liner' ###
  89. convert -size "$a"x"$b" xc:transparent \
  90. \
  91. -fill none -draw 'stroke black stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c1'' \
  92. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n1",0 '1'" \
  93. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n1",0 '1'" \
  94. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n1" '1'" \
  95. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n1" '1'" \
  96. \
  97. -fill none -draw 'stroke black stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c2'' \
  98. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n2",0 '2'" \
  99. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n2",0 '2'" \
  100. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n2" '2'" \
  101. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n2" '2'" \
  102. \
  103. -fill none -draw 'stroke black stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c3'' \
  104. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n3",0 '3'" \
  105. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n3",0 '3'" \
  106. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n3" '3'" \
  107. -fill black -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n3" '3'" \
  108. \
  109. -fill black -draw 'stroke black stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c4'' \
  110. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n4",0 '4'" \
  111. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n4",0 '4'" \
  112. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n4" '4'" \
  113. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n4" '4'" \
  114. \
  115. -fill black -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c5'' \
  116. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n5",0 '5'" \
  117. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n5",0 '5'" \
  118. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n5" '5'" \
  119. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n5" '5'" \
  120. \
  121. -fill black -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c6'' \
  122. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n6",0 '6'" \
  123. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n6",0 '6'" \
  124. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n6" '6'" \
  125. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n6" '6'" \
  126. \
  127. -fill black -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c7'' \
  128. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n7",0 '7'" \
  129. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n7",0 '7'" \
  130. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n7" '7'" \
  131. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n7" '7'" \
  132. \
  133. -fill black -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c8'' \
  134. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text "$n8",0 '8'" \
  135. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text -"$n8",0 '8'" \
  136. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,"$n8" '8'" \
  137. -fill white -density $DPI -pointsize 12 -gravity center -font DIN-1451-Engschrift -draw "text 0,-"$n8" '8'" \
  138. \
  139. -fill black -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c9'' \
  140. \
  141. -fill white -draw 'stroke white stroke-width '$rt' circle '$ahalf','$bhalf' '$ahalf','$c10'' \
  142. \
  143. -fill none -draw 'stroke green stroke-width .1 stroke-dasharray 2 2 rectangle '$ahalf','$bhalf' '$c1','$c1'' \
  144. \
  145. -density $DPI ISSF-10mAirRifleTarget.png
  146.  
  147. echo "a = $a"
  148. echo "b = $b"
  149. echo "ahalf = $ahalf"
  150. echo "bhalf = $bhalf"
  151. echo "rt = $rt"
  152. echo "one = $one"
  153. echo "n1 = $n1"
  154. echo "c1 = $c1"
  155. echo "..."
  156.  
  157. # Show picture resolution
  158. # identify -format "%w x %h %x x %y" ISSF-10mAirRifle.png
  159. #
  160. # Show monitor resolution
  161. # xdpyinfo | grep -B 2 resolution
  162. #
  163. # https://aur.archlinux.org/packages/ttf-din1451/
  164. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement