Draw outline of combined rectangles in canvas

Is there a good algorithmic way to combine multiple squares (each has four x/y points) to draw an outline of the joined figured in canvas? The figures I would want to make sure work are as follows: - two squares joined to make a rectangle - four squares joined to make a larger square - two squares that are diagonal like a rectangle with triangles at each end at 45 degrees - this is probably the most irregular/special case... - three or four squares joined to make a concave shape like a Tetris(TM) piece 'L' piece Is there an easy way to calculate the outer points to use to draw a line path (and maybe a filled figure) from all of the squares points? Thanks! **Update:** the reason we want to do this is because we want to show squares that are of the same group that are next to each other in a 2xn array specifically (but could also be 1xn in some cases). Maybe there is an easier answer if I just iterate through the different squares and form groupings some other way?
Any language preference?

以上就是Draw outline of combined rectangles in canvas的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏