Bash程序用于计算距离的点位置

时间:2017-05-30 16:07:57

标签: bash calculator bc

所以,我正在尝试编写一个bash程序来计算渲染图像所需的点。我需要计算一个数组中的各个点。 A的点应该与它们从中心行进的方向相同,但是具有脚本中定义的特定距离。 B的输出点应该相对于它们的A对应物。 (例如:B点的第一个输出应该使X等于A-12点的X输出,而Y应该等于A点+8的Y输出)

为了使事情更清楚,我试图使用ImageMagick在圆的边缘绘制线条,我需要将点A映射到圆的边缘并将线条绘制为B.这是测试代码我正在研究的样本:

#!/bin/bash

#Define points
center='512,423'
pointa=( '256,192' '128,244' '192,192' '256,512' '384,192' )
pointb=( '244,200' '111,222' '200,185' '267,397' '333,234' )

  calp(){ for ((i=0;i<${#pointa[@]};i++));do 
              abasex="`echo "${pointa[$i]}"|cut -d',' -f1`"
              abasey="`echo "${pointa[$i]}"|cut -d',' -f2`"
              bbasex="`echo "${pointb[$i]}"|cut -d',' -f1`"
              bbasey="`echo "${pointb[$i]}"|cut -d',' -f2`"
              boffsx="`echo "$bbasex-$abasex"|bc`"
              boffsy="`echo "$bbasey-$abasey"|bc`"
              #//Calculation code for point A goes here\\#
              bx="`echo "$ax+$boffsx"|sed 's/+-/-/g'|bc`"
              by="`echo "$ay+$boffsy"|sed 's/+-/-/g'|bc`"
              calcda="$ax,$ay";calcdb="$bx,$by"

              printf "Line $i) A:$calcda B:$calcdb D:$dist"
            done;};

for dist in {30..70};do calp;done

为了澄清,我想将A点中的每个点转换为与$center相同的方向,以匹配$dist中的每个距离,并将相同的转换应用于相应的点B,然后返回A点和B点的X和Y值,以及给定的距离。可以找到计算指南here

1 个答案:

答案 0 :(得分:1)

我仍在努力理解你的问题,并努力解决问题。到目前为止,我已经简化并删除了大量运行bccut和内容的不必要的额外进程,以使用更快的内部bash机制。

我正在使用Pontio的方法here

#!/bin/bash

#Define points
center='512,423'
pointa=( '256,192' '128,244' '192,192' '256,512' '384,192' )
pointb=( '244,200' '111,222' '200,185' '267,397' '333,234' )

calp(){
   # Extract x,y of centre
   xa=${center/,*/}
   ya=${center/*,/}
   echo "dist:$dist, xa:$xa, ya:$ya"

   for ((i=0;i<${#pointa[@]};i++));do 
      xb=${pointa[$i]/,*/}       # remove comma and everything after
      yb=${pointa[$i]/*,/}       # remove everything up to and including comma
      ((dx=xa-xb))
      ((dy=ya-yb))
      D=$( bc <<< "scale=5;sqrt($dx*$dx+$dy*$dy)")
      xc=$(bc <<< "scale=0;$xa - ($dist*$dx)/$D")      # scale=0 to force integer result
      yc=$(bc <<< "scale=0;$ya - ($dist*$dy)/$D")      # scale=0 to force integer result
      # Now get the x and y translation
      ((xtrans=xc-xb))
      ((ytrans=yc-yb))
      # Get x,y of other set
      xother=${pointb[$i]/,*/}       # remove comma and everything after
      yother=${pointb[$i]/*,/}       # remove everything up to and including comma
      # Apply same translation
      ((xother=xother+xtrans))
      ((yother=yother+ytrans))
      echo "   i:$i xb:$xb, yb:$yb, D:$D, xc:$xc, yc:$yc, xtrans:$xtrans, ytrans:$ytrans, xother:$xother, yother:$yother"
   done
}

for dist in {30..70};do
  calp
done

以下是我得到的输出:

dist:30, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:490, yc:403, xtrans:234, ytrans:211, xother:478, yother:411
   i:1 xb:128, yb:244, D:423.67086, xc:485, yc:411, xtrans:357, ytrans:167, xother:468, yother:389
   i:2 xb:192, yb:192, D:394.66568, xc:488, yc:406, xtrans:296, ytrans:214, xother:496, yother:399
   i:3 xb:256, yb:512, D:271.02951, xc:484, yc:432, xtrans:228, ytrans:-80, xother:495, yother:317
   i:4 xb:384, yb:192, D:264.09278, xc:498, yc:397, xtrans:114, ytrans:205, xother:447, yother:439
dist:31, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:489, yc:403, xtrans:233, ytrans:211, xother:477, yother:411
   i:1 xb:128, yb:244, D:423.67086, xc:484, yc:410, xtrans:356, ytrans:166, xother:467, yother:388
   i:2 xb:192, yb:192, D:394.66568, xc:487, yc:405, xtrans:295, ytrans:213, xother:495, yother:398
   i:3 xb:256, yb:512, D:271.02951, xc:483, yc:433, xtrans:227, ytrans:-79, xother:494, yother:318
   i:4 xb:384, yb:192, D:264.09278, xc:497, yc:396, xtrans:113, ytrans:204, xother:446, yother:438
dist:32, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:489, yc:402, xtrans:233, ytrans:210, xother:477, yother:410
   i:1 xb:128, yb:244, D:423.67086, xc:483, yc:410, xtrans:355, ytrans:166, xother:466, yother:388
   i:2 xb:192, yb:192, D:394.66568, xc:487, yc:405, xtrans:295, ytrans:213, xother:495, yother:398
   i:3 xb:256, yb:512, D:271.02951, xc:482, yc:433, xtrans:226, ytrans:-79, xother:493, yother:318
   i:4 xb:384, yb:192, D:264.09278, xc:497, yc:396, xtrans:113, ytrans:204, xother:446, yother:438
dist:33, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:488, yc:401, xtrans:232, ytrans:209, xother:476, yother:409
   i:1 xb:128, yb:244, D:423.67086, xc:483, yc:410, xtrans:355, ytrans:166, xother:466, yother:388
   i:2 xb:192, yb:192, D:394.66568, xc:486, yc:404, xtrans:294, ytrans:212, xother:494, yother:397
   i:3 xb:256, yb:512, D:271.02951, xc:481, yc:433, xtrans:225, ytrans:-79, xother:492, yother:318
   i:4 xb:384, yb:192, D:264.09278, xc:497, yc:395, xtrans:113, ytrans:203, xother:446, yother:437
dist:34, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:487, yc:401, xtrans:231, ytrans:209, xother:475, yother:409
   i:1 xb:128, yb:244, D:423.67086, xc:482, yc:409, xtrans:354, ytrans:165, xother:465, yother:387
   i:2 xb:192, yb:192, D:394.66568, xc:485, yc:404, xtrans:293, ytrans:212, xother:493, yother:397
   i:3 xb:256, yb:512, D:271.02951, xc:480, yc:434, xtrans:224, ytrans:-78, xother:491, yother:319
   i:4 xb:384, yb:192, D:264.09278, xc:496, yc:394, xtrans:112, ytrans:202, xother:445, yother:436
dist:35, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:487, yc:400, xtrans:231, ytrans:208, xother:475, yother:408
   i:1 xb:128, yb:244, D:423.67086, xc:481, yc:409, xtrans:353, ytrans:165, xother:464, yother:387
   i:2 xb:192, yb:192, D:394.66568, xc:484, yc:403, xtrans:292, ytrans:211, xother:492, yother:396
   i:3 xb:256, yb:512, D:271.02951, xc:479, yc:434, xtrans:223, ytrans:-78, xother:490, yother:319
   i:4 xb:384, yb:192, D:264.09278, xc:496, yc:393, xtrans:112, ytrans:201, xother:445, yother:435
dist:36, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:486, yc:399, xtrans:230, ytrans:207, xother:474, yother:407
   i:1 xb:128, yb:244, D:423.67086, xc:480, yc:408, xtrans:352, ytrans:164, xother:463, yother:386
   i:2 xb:192, yb:192, D:394.66568, xc:483, yc:402, xtrans:291, ytrans:210, xother:491, yother:395
   i:3 xb:256, yb:512, D:271.02951, xc:478, yc:434, xtrans:222, ytrans:-78, xother:489, yother:319
   i:4 xb:384, yb:192, D:264.09278, xc:495, yc:392, xtrans:111, ytrans:200, xother:444, yother:434
dist:37, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:485, yc:399, xtrans:229, ytrans:207, xother:473, yother:407
   i:1 xb:128, yb:244, D:423.67086, xc:479, yc:408, xtrans:351, ytrans:164, xother:462, yother:386
   i:2 xb:192, yb:192, D:394.66568, xc:482, yc:402, xtrans:290, ytrans:210, xother:490, yother:395
   i:3 xb:256, yb:512, D:271.02951, xc:478, yc:435, xtrans:222, ytrans:-77, xother:489, yother:320
   i:4 xb:384, yb:192, D:264.09278, xc:495, yc:391, xtrans:111, ytrans:199, xother:444, yother:433
dist:38, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:484, yc:398, xtrans:228, ytrans:206, xother:472, yother:406
   i:1 xb:128, yb:244, D:423.67086, xc:478, yc:407, xtrans:350, ytrans:163, xother:461, yother:385
   i:2 xb:192, yb:192, D:394.66568, xc:482, yc:401, xtrans:290, ytrans:209, xother:490, yother:394
   i:3 xb:256, yb:512, D:271.02951, xc:477, yc:435, xtrans:221, ytrans:-77, xother:488, yother:320
   i:4 xb:384, yb:192, D:264.09278, xc:494, yc:390, xtrans:110, ytrans:198, xother:443, yother:432
dist:39, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:484, yc:397, xtrans:228, ytrans:205, xother:472, yother:405
   i:1 xb:128, yb:244, D:423.67086, xc:477, yc:407, xtrans:349, ytrans:163, xother:460, yother:385
   i:2 xb:192, yb:192, D:394.66568, xc:481, yc:401, xtrans:289, ytrans:209, xother:489, yother:394
   i:3 xb:256, yb:512, D:271.02951, xc:476, yc:435, xtrans:220, ytrans:-77, xother:487, yother:320
   i:4 xb:384, yb:192, D:264.09278, xc:494, yc:389, xtrans:110, ytrans:197, xother:443, yother:431
dist:40, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:483, yc:397, xtrans:227, ytrans:205, xother:471, yother:405
   i:1 xb:128, yb:244, D:423.67086, xc:476, yc:407, xtrans:348, ytrans:163, xother:459, yother:385
   i:2 xb:192, yb:192, D:394.66568, xc:480, yc:400, xtrans:288, ytrans:208, xother:488, yother:393
   i:3 xb:256, yb:512, D:271.02951, xc:475, yc:436, xtrans:219, ytrans:-76, xother:486, yother:321
   i:4 xb:384, yb:192, D:264.09278, xc:493, yc:389, xtrans:109, ytrans:197, xother:442, yother:431
dist:41, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:482, yc:396, xtrans:226, ytrans:204, xother:470, yother:404
   i:1 xb:128, yb:244, D:423.67086, xc:475, yc:406, xtrans:347, ytrans:162, xother:458, yother:384
   i:2 xb:192, yb:192, D:394.66568, xc:479, yc:400, xtrans:287, ytrans:208, xother:487, yother:393
   i:3 xb:256, yb:512, D:271.02951, xc:474, yc:436, xtrans:218, ytrans:-76, xother:485, yother:321
   i:4 xb:384, yb:192, D:264.09278, xc:493, yc:388, xtrans:109, ytrans:196, xother:442, yother:430
dist:42, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:481, yc:395, xtrans:225, ytrans:203, xother:469, yother:403
   i:1 xb:128, yb:244, D:423.67086, xc:474, yc:406, xtrans:346, ytrans:162, xother:457, yother:384
   i:2 xb:192, yb:192, D:394.66568, xc:478, yc:399, xtrans:286, ytrans:207, xother:486, yother:392
   i:3 xb:256, yb:512, D:271.02951, xc:473, yc:436, xtrans:217, ytrans:-76, xother:484, yother:321
   i:4 xb:384, yb:192, D:264.09278, xc:492, yc:387, xtrans:108, ytrans:195, xother:441, yother:429
dist:43, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:481, yc:395, xtrans:225, ytrans:203, xother:469, yother:403
   i:1 xb:128, yb:244, D:423.67086, xc:474, yc:405, xtrans:346, ytrans:161, xother:457, yother:383
   i:2 xb:192, yb:192, D:394.66568, xc:478, yc:398, xtrans:286, ytrans:206, xother:486, yother:391
   i:3 xb:256, yb:512, D:271.02951, xc:472, yc:437, xtrans:216, ytrans:-75, xother:483, yother:322
   i:4 xb:384, yb:192, D:264.09278, xc:492, yc:386, xtrans:108, ytrans:194, xother:441, yother:428
dist:44, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:480, yc:394, xtrans:224, ytrans:202, xother:468, yother:402
   i:1 xb:128, yb:244, D:423.67086, xc:473, yc:405, xtrans:345, ytrans:161, xother:456, yother:383
   i:2 xb:192, yb:192, D:394.66568, xc:477, yc:398, xtrans:285, ytrans:206, xother:485, yother:391
   i:3 xb:256, yb:512, D:271.02951, xc:471, yc:437, xtrans:215, ytrans:-75, xother:482, yother:322
   i:4 xb:384, yb:192, D:264.09278, xc:491, yc:385, xtrans:107, ytrans:193, xother:440, yother:427
dist:45, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:479, yc:393, xtrans:223, ytrans:201, xother:467, yother:401
   i:1 xb:128, yb:244, D:423.67086, xc:472, yc:404, xtrans:344, ytrans:160, xother:455, yother:382
   i:2 xb:192, yb:192, D:394.66568, xc:476, yc:397, xtrans:284, ytrans:205, xother:484, yother:390
   i:3 xb:256, yb:512, D:271.02951, xc:470, yc:437, xtrans:214, ytrans:-75, xother:481, yother:322
   i:4 xb:384, yb:192, D:264.09278, xc:491, yc:384, xtrans:107, ytrans:192, xother:440, yother:426
dist:46, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:478, yc:393, xtrans:222, ytrans:201, xother:466, yother:401
   i:1 xb:128, yb:244, D:423.67086, xc:471, yc:404, xtrans:343, ytrans:160, xother:454, yother:382
   i:2 xb:192, yb:192, D:394.66568, xc:475, yc:397, xtrans:283, ytrans:205, xother:483, yother:390
   i:3 xb:256, yb:512, D:271.02951, xc:469, yc:438, xtrans:213, ytrans:-74, xother:480, yother:323
   i:4 xb:384, yb:192, D:264.09278, xc:490, yc:383, xtrans:106, ytrans:191, xother:439, yother:425
dist:47, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:478, yc:392, xtrans:222, ytrans:200, xother:466, yother:400
   i:1 xb:128, yb:244, D:423.67086, xc:470, yc:404, xtrans:342, ytrans:160, xother:453, yother:382
   i:2 xb:192, yb:192, D:394.66568, xc:474, yc:396, xtrans:282, ytrans:204, xother:482, yother:389
   i:3 xb:256, yb:512, D:271.02951, xc:468, yc:438, xtrans:212, ytrans:-74, xother:479, yother:323
   i:4 xb:384, yb:192, D:264.09278, xc:490, yc:382, xtrans:106, ytrans:190, xother:439, yother:424
dist:48, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:477, yc:391, xtrans:221, ytrans:199, xother:465, yother:399
   i:1 xb:128, yb:244, D:423.67086, xc:469, yc:403, xtrans:341, ytrans:159, xother:452, yother:381
   i:2 xb:192, yb:192, D:394.66568, xc:474, yc:395, xtrans:282, ytrans:203, xother:482, yother:388
   i:3 xb:256, yb:512, D:271.02951, xc:467, yc:438, xtrans:211, ytrans:-74, xother:478, yother:323
   i:4 xb:384, yb:192, D:264.09278, xc:489, yc:382, xtrans:105, ytrans:190, xother:438, yother:424
dist:49, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:476, yc:391, xtrans:220, ytrans:199, xother:464, yother:399
   i:1 xb:128, yb:244, D:423.67086, xc:468, yc:403, xtrans:340, ytrans:159, xother:451, yother:381
   i:2 xb:192, yb:192, D:394.66568, xc:473, yc:395, xtrans:281, ytrans:203, xother:481, yother:388
   i:3 xb:256, yb:512, D:271.02951, xc:466, yc:439, xtrans:210, ytrans:-73, xother:477, yother:324
   i:4 xb:384, yb:192, D:264.09278, xc:489, yc:381, xtrans:105, ytrans:189, xother:438, yother:423
dist:50, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:475, yc:390, xtrans:219, ytrans:198, xother:463, yother:398
   i:1 xb:128, yb:244, D:423.67086, xc:467, yc:402, xtrans:339, ytrans:158, xother:450, yother:380
   i:2 xb:192, yb:192, D:394.66568, xc:472, yc:394, xtrans:280, ytrans:202, xother:480, yother:387
   i:3 xb:256, yb:512, D:271.02951, xc:465, yc:439, xtrans:209, ytrans:-73, xother:476, yother:324
   i:4 xb:384, yb:192, D:264.09278, xc:488, yc:380, xtrans:104, ytrans:188, xother:437, yother:422
dist:51, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:475, yc:389, xtrans:219, ytrans:197, xother:463, yother:397
   i:1 xb:128, yb:244, D:423.67086, xc:466, yc:402, xtrans:338, ytrans:158, xother:449, yother:380
   i:2 xb:192, yb:192, D:394.66568, xc:471, yc:394, xtrans:279, ytrans:202, xother:479, yother:387
   i:3 xb:256, yb:512, D:271.02951, xc:464, yc:439, xtrans:208, ytrans:-73, xother:475, yother:324
   i:4 xb:384, yb:192, D:264.09278, xc:488, yc:379, xtrans:104, ytrans:187, xother:437, yother:421
dist:52, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:474, yc:389, xtrans:218, ytrans:197, xother:462, yother:397
   i:1 xb:128, yb:244, D:423.67086, xc:465, yc:402, xtrans:337, ytrans:158, xother:448, yother:380
   i:2 xb:192, yb:192, D:394.66568, xc:470, yc:393, xtrans:278, ytrans:201, xother:478, yother:386
   i:3 xb:256, yb:512, D:271.02951, xc:463, yc:440, xtrans:207, ytrans:-72, xother:474, yother:325
   i:4 xb:384, yb:192, D:264.09278, xc:487, yc:378, xtrans:103, ytrans:186, xother:436, yother:420
dist:53, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:473, yc:388, xtrans:217, ytrans:196, xother:461, yother:396
   i:1 xb:128, yb:244, D:423.67086, xc:464, yc:401, xtrans:336, ytrans:157, xother:447, yother:379
   i:2 xb:192, yb:192, D:394.66568, xc:470, yc:392, xtrans:278, ytrans:200, xother:478, yother:385
   i:3 xb:256, yb:512, D:271.02951, xc:462, yc:440, xtrans:206, ytrans:-72, xother:473, yother:325
   i:4 xb:384, yb:192, D:264.09278, xc:487, yc:377, xtrans:103, ytrans:185, xother:436, yother:419
dist:54, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:472, yc:387, xtrans:216, ytrans:195, xother:460, yother:395
   i:1 xb:128, yb:244, D:423.67086, xc:464, yc:401, xtrans:336, ytrans:157, xother:447, yother:379
   i:2 xb:192, yb:192, D:394.66568, xc:469, yc:392, xtrans:277, ytrans:200, xother:477, yother:385
   i:3 xb:256, yb:512, D:271.02951, xc:461, yc:440, xtrans:205, ytrans:-72, xother:472, yother:325
   i:4 xb:384, yb:192, D:264.09278, xc:486, yc:376, xtrans:102, ytrans:184, xother:435, yother:418
dist:55, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:472, yc:387, xtrans:216, ytrans:195, xother:460, yother:395
   i:1 xb:128, yb:244, D:423.67086, xc:463, yc:400, xtrans:335, ytrans:156, xother:446, yother:378
   i:2 xb:192, yb:192, D:394.66568, xc:468, yc:391, xtrans:276, ytrans:199, xother:476, yother:384
   i:3 xb:256, yb:512, D:271.02951, xc:461, yc:441, xtrans:205, ytrans:-71, xother:472, yother:326
   i:4 xb:384, yb:192, D:264.09278, xc:486, yc:375, xtrans:102, ytrans:183, xother:435, yother:417
dist:56, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:471, yc:386, xtrans:215, ytrans:194, xother:459, yother:394
   i:1 xb:128, yb:244, D:423.67086, xc:462, yc:400, xtrans:334, ytrans:156, xother:445, yother:378
   i:2 xb:192, yb:192, D:394.66568, xc:467, yc:391, xtrans:275, ytrans:199, xother:475, yother:384
   i:3 xb:256, yb:512, D:271.02951, xc:460, yc:441, xtrans:204, ytrans:-71, xother:471, yother:326
   i:4 xb:384, yb:192, D:264.09278, xc:485, yc:375, xtrans:101, ytrans:183, xother:434, yother:417
dist:57, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:470, yc:385, xtrans:214, ytrans:193, xother:458, yother:393
   i:1 xb:128, yb:244, D:423.67086, xc:461, yc:399, xtrans:333, ytrans:155, xother:444, yother:377
   i:2 xb:192, yb:192, D:394.66568, xc:466, yc:390, xtrans:274, ytrans:198, xother:474, yother:383
   i:3 xb:256, yb:512, D:271.02951, xc:459, yc:441, xtrans:203, ytrans:-71, xother:470, yother:326
   i:4 xb:384, yb:192, D:264.09278, xc:485, yc:374, xtrans:101, ytrans:182, xother:434, yother:416
dist:58, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:469, yc:385, xtrans:213, ytrans:193, xother:457, yother:393
   i:1 xb:128, yb:244, D:423.67086, xc:460, yc:399, xtrans:332, ytrans:155, xother:443, yother:377
   i:2 xb:192, yb:192, D:394.66568, xc:465, yc:390, xtrans:273, ytrans:198, xother:473, yother:383
   i:3 xb:256, yb:512, D:271.02951, xc:458, yc:442, xtrans:202, ytrans:-70, xother:469, yother:327
   i:4 xb:384, yb:192, D:264.09278, xc:484, yc:373, xtrans:100, ytrans:181, xother:433, yother:415
dist:59, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:469, yc:384, xtrans:213, ytrans:192, xother:457, yother:392
   i:1 xb:128, yb:244, D:423.67086, xc:459, yc:399, xtrans:331, ytrans:155, xother:442, yother:377
   i:2 xb:192, yb:192, D:394.66568, xc:465, yc:389, xtrans:273, ytrans:197, xother:473, yother:382
   i:3 xb:256, yb:512, D:271.02951, xc:457, yc:442, xtrans:201, ytrans:-70, xother:468, yother:327
   i:4 xb:384, yb:192, D:264.09278, xc:484, yc:372, xtrans:100, ytrans:180, xother:433, yother:414
dist:60, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:468, yc:383, xtrans:212, ytrans:191, xother:456, yother:391
   i:1 xb:128, yb:244, D:423.67086, xc:458, yc:398, xtrans:330, ytrans:154, xother:441, yother:376
   i:2 xb:192, yb:192, D:394.66568, xc:464, yc:388, xtrans:272, ytrans:196, xother:472, yother:381
   i:3 xb:256, yb:512, D:271.02951, xc:456, yc:442, xtrans:200, ytrans:-70, xother:467, yother:327
   i:4 xb:384, yb:192, D:264.09278, xc:483, yc:371, xtrans:99, ytrans:179, xother:432, yother:413
dist:61, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:467, yc:383, xtrans:211, ytrans:191, xother:455, yother:391
   i:1 xb:128, yb:244, D:423.67086, xc:457, yc:398, xtrans:329, ytrans:154, xother:440, yother:376
   i:2 xb:192, yb:192, D:394.66568, xc:463, yc:388, xtrans:271, ytrans:196, xother:471, yother:381
   i:3 xb:256, yb:512, D:271.02951, xc:455, yc:443, xtrans:199, ytrans:-69, xother:466, yother:328
   i:4 xb:384, yb:192, D:264.09278, xc:483, yc:370, xtrans:99, ytrans:178, xother:432, yother:412
dist:62, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:466, yc:382, xtrans:210, ytrans:190, xother:454, yother:390
   i:1 xb:128, yb:244, D:423.67086, xc:456, yc:397, xtrans:328, ytrans:153, xother:439, yother:375
   i:2 xb:192, yb:192, D:394.66568, xc:462, yc:387, xtrans:270, ytrans:195, xother:470, yother:380
   i:3 xb:256, yb:512, D:271.02951, xc:454, yc:443, xtrans:198, ytrans:-69, xother:465, yother:328
   i:4 xb:384, yb:192, D:264.09278, xc:482, yc:369, xtrans:98, ytrans:177, xother:431, yother:411
dist:63, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:466, yc:381, xtrans:210, ytrans:189, xother:454, yother:389
   i:1 xb:128, yb:244, D:423.67086, xc:455, yc:397, xtrans:327, ytrans:153, xother:438, yother:375
   i:2 xb:192, yb:192, D:394.66568, xc:461, yc:387, xtrans:269, ytrans:195, xother:469, yother:380
   i:3 xb:256, yb:512, D:271.02951, xc:453, yc:443, xtrans:197, ytrans:-69, xother:464, yother:328
   i:4 xb:384, yb:192, D:264.09278, xc:482, yc:368, xtrans:98, ytrans:176, xother:431, yother:410
dist:64, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:465, yc:381, xtrans:209, ytrans:189, xother:453, yother:389
   i:1 xb:128, yb:244, D:423.67086, xc:454, yc:396, xtrans:326, ytrans:152, xother:437, yother:374
   i:2 xb:192, yb:192, D:394.66568, xc:461, yc:386, xtrans:269, ytrans:194, xother:469, yother:379
   i:3 xb:256, yb:512, D:271.02951, xc:452, yc:444, xtrans:196, ytrans:-68, xother:463, yother:329
   i:4 xb:384, yb:192, D:264.09278, xc:481, yc:368, xtrans:97, ytrans:176, xother:430, yother:410
dist:65, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:464, yc:380, xtrans:208, ytrans:188, xother:452, yother:388
   i:1 xb:128, yb:244, D:423.67086, xc:454, yc:396, xtrans:326, ytrans:152, xother:437, yother:374
   i:2 xb:192, yb:192, D:394.66568, xc:460, yc:385, xtrans:268, ytrans:193, xother:468, yother:378
   i:3 xb:256, yb:512, D:271.02951, xc:451, yc:444, xtrans:195, ytrans:-68, xother:462, yother:329
   i:4 xb:384, yb:192, D:264.09278, xc:481, yc:367, xtrans:97, ytrans:175, xother:430, yother:409
dist:66, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:463, yc:379, xtrans:207, ytrans:187, xother:451, yother:387
   i:1 xb:128, yb:244, D:423.67086, xc:453, yc:396, xtrans:325, ytrans:152, xother:436, yother:374
   i:2 xb:192, yb:192, D:394.66568, xc:459, yc:385, xtrans:267, ytrans:193, xother:467, yother:378
   i:3 xb:256, yb:512, D:271.02951, xc:450, yc:444, xtrans:194, ytrans:-68, xother:461, yother:329
   i:4 xb:384, yb:192, D:264.09278, xc:481, yc:366, xtrans:97, ytrans:174, xother:430, yother:408
dist:67, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:463, yc:379, xtrans:207, ytrans:187, xother:451, yother:387
   i:1 xb:128, yb:244, D:423.67086, xc:452, yc:395, xtrans:324, ytrans:151, xother:435, yother:373
   i:2 xb:192, yb:192, D:394.66568, xc:458, yc:384, xtrans:266, ytrans:192, xother:466, yother:377
   i:3 xb:256, yb:512, D:271.02951, xc:449, yc:445, xtrans:193, ytrans:-67, xother:460, yother:330
   i:4 xb:384, yb:192, D:264.09278, xc:480, yc:365, xtrans:96, ytrans:173, xother:429, yother:407
dist:68, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:462, yc:378, xtrans:206, ytrans:186, xother:450, yother:386
   i:1 xb:128, yb:244, D:423.67086, xc:451, yc:395, xtrans:323, ytrans:151, xother:434, yother:373
   i:2 xb:192, yb:192, D:394.66568, xc:457, yc:384, xtrans:265, ytrans:192, xother:465, yother:377
   i:3 xb:256, yb:512, D:271.02951, xc:448, yc:445, xtrans:192, ytrans:-67, xother:459, yother:330
   i:4 xb:384, yb:192, D:264.09278, xc:480, yc:364, xtrans:96, ytrans:172, xother:429, yother:406
dist:69, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:461, yc:377, xtrans:205, ytrans:185, xother:449, yother:385
   i:1 xb:128, yb:244, D:423.67086, xc:450, yc:394, xtrans:322, ytrans:150, xother:433, yother:372
   i:2 xb:192, yb:192, D:394.66568, xc:457, yc:383, xtrans:265, ytrans:191, xother:465, yother:376
   i:3 xb:256, yb:512, D:271.02951, xc:447, yc:445, xtrans:191, ytrans:-67, xother:458, yother:330
   i:4 xb:384, yb:192, D:264.09278, xc:479, yc:363, xtrans:95, ytrans:171, xother:428, yother:405
dist:70, xa:512, ya:423
   i:0 xb:256, yb:192, D:344.81444, xc:461, yc:377, xtrans:205, ytrans:185, xother:449, yother:385
   i:1 xb:128, yb:244, D:423.67086, xc:449, yc:394, xtrans:321, ytrans:150, xother:432, yother:372
   i:2 xb:192, yb:192, D:394.66568, xc:456, yc:383, xtrans:264, ytrans:191, xother:464, yother:376
   i:3 xb:256, yb:512, D:271.02951, xc:446, yc:445, xtrans:190, ytrans:-67, xother:457, yother:330
   i:4 xb:384, yb:192, D:264.09278, xc:479, yc:362, xtrans:95, ytrans:170, xother:428, yother:404

我还绘制了一个pointa坐标的图像,当你通过数组时逐渐变红,pointb逐渐变蓝,当你穿过数组并且中心是白色的时候。但是,对于你要做的事情,我绝对不是明智的。

convert -size 600x600 xc:black -fill white -draw "circle 512,423 512,428" \
   -fill "rgba(255,0,0,0.6)" -draw "circle 256,192 256,197" \
   -fill "rgba(255,0,0,0.7)" -draw "circle 128,244 128,249" \
   -fill "rgba(255,0,0,0.8)" -draw "circle 192,192 192,197" \
   -fill "rgba(255,0,0,0.9)" -draw "circle 256,512 256,517" \
   -fill "rgba(255,0,0,1.0)" -draw "circle 384,192 384,197" \
   -fill "rgba(0,0,255,0.6)" -draw "circle 244,200 244,205" \
   -fill "rgba(0,0,255,0.7)" -draw "circle 111,222 111,227" \
   -fill "rgba(0,0,255,0.8)" -draw "circle 200,185 200,190" \
   -fill "rgba(0,0,255,0.9)" -draw "circle 267,397 267,402" \
   -fill "rgba(0,0,255,1.0)" -draw "circle 333,234 333,239" \
   image.png

enter image description here