如何在C#桌面程序中显示码垛图形? [英] How to display Palletizing graphics in C# desktop program?

查看:219
本文介绍了如何在C#桌面程序中显示码垛图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将纸箱放在C#桌面程序中的托盘中时显示.
机械手将纸箱放在托盘中后,我需要一一展示.即,最初托盘将是空的.当机器人放置第一个托盘时,我需要在第一个位置显示纸箱.

注意:无需显示确切图片.一个简单的图纸就足够了.

与此类似


http://stock-image.mediafocus.com/images/previews/stack-carton-boxes-pallet-isolated-white-am1112087.jpg [

I need to display cartons as when it is placed in pallets in C# desktop program.
I need to display one by one, after the robo places the carton in pallet. i.e, initally the pallet will be empty. when the robo places first pallet i need to show carton in first positon.

NOTE: No need to show the exact picture. A simple drawing is enough.

similar to this


http://stock-image.mediafocus.com/images/previews/stack-carton-boxes-pallet-isolated-white-am1112087.jpg[^]

How can we do this for different combination 2x3x5, 2x2x2 etc??

推荐答案

您绘制一个纸箱作为由三个平行四边形组成的六边形.两侧是垂直的.调整三个脸部的亮度,以模仿环境照明的效果.您还可以绘制六个可见边缘.使用Graphics.FillPolygon 方法.

现在,当您将纸箱彼此相邻放置时,六边形刚好平移,平移矢量等于内边缘之一,对应于X,Y,Z移动.这使您可以计算盒子在托盘上任何位置的位置.

要渲染纸箱并去除隐藏的零件,您将诉诸于画家的算法:开始在背面绘制盒子.前面的将隐藏在后面.
You draw a single carton as an hexagon formed of three parallelograms. Two of the sides are vertical. Adjust the lightness of the three faces to mimic the effect of ambiant lighting. You can also draw the six visible edges. Use the Graphics.FillPolygon method.

Now, when you place the cartons next to each other, the hexagons just translate, with the translation vector being equal to one of the inner edges, corresponding to X, Y, Z moves. This allows you to compute the position of a box anywhere on the pallet.

To render the cartons with hidden parts removal, you will resort to the painter''s algorithm: start drawing the boxes at the back. The ones in front will hide those behind.


这篇关于如何在C#桌面程序中显示码垛图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆