美文网首页
贴标机自定义工位起始点以及基准对调时的坐标计算

贴标机自定义工位起始点以及基准对调时的坐标计算

作者: Swift编程初学者 | 来源:发表于2022-04-29 10:02 被阅读0次

先上图

大板示例

计算坐标

小板1

原始数据:

{
    "width": 200,
    "height": 500,
    "start_x": 0,
    "start_y": 0,
   "big_plank_width": 640,
   "big_plank_height": 1200
}

根据工位起始点计算新的start_xstart_y

start_x = start_x - big_plank_width
start_y = start_y - big_plank_height

计算贴标坐标

x = start_x + width / 2
y = start_y + height / 2

左下角

贴标坐标为(100, 250)

左上角

贴标坐标为(100, -950)

右上角

贴标坐标为(-540, -950)

右下角

贴标坐标为(-540, 250)

小板2

原始数据:

{
    "width": 200,
    "height": 400,
    "start_x": 200,
    "start_y": 0,
   "big_plank_width": 640,
   "big_plank_height": 1200
}

左下角

贴标坐标为(300, 200)

左上角

贴标坐标为(300, -1000)

右上角

贴标坐标为(-340, -1000)

右下角

贴标坐标为(-340, 200)

小板3

原始数据:

{
    "width": 300,
    "height": 500,
    "start_x": 0,
    "start_y": 500,
   "big_plank_width": 640,
   "big_plank_height": 1200
}

左下角

贴标坐标为(150, 750)

左上角

贴标坐标为(150, -450)

右上角

贴标坐标为(-490, -450)

右下角

贴标坐标为(-490, 750)

小板4

原始数据:

{
    "width": 200,
    "height": 500,
    "start_x": 300,
    "start_y": 400,
   "big_plank_width": 640,
   "big_plank_height": 1200
}

左下角

贴标坐标为(400, 650)

左上角

贴标坐标为(400, -550)

右上角

贴标坐标为(-240, -550)

右下角

贴标坐标为(-240, 650)

基准对调

  • 如果工位起始点在左下角或左上角, X轴对调后的x坐标计算公式为x = big_plank_width - x

  • 如果工位起始点在右下角或右上角, X轴对调后的x坐标计算公式为x = (-1) *big_plank_width - x

  • 如果工位起始点在左下角或右下角, Y轴对调后的x坐标计算公式为y = big_plank_height - y

  • 如果工位起始点在左上角或右上角, Y轴对调后的x坐标计算公式为y = (-1) * big_plank_height - y

相关文章

网友评论

      本文标题:贴标机自定义工位起始点以及基准对调时的坐标计算

      本文链接:https://www.haomeiwen.com/subject/tzudyrtx.html