1
z8018
2025-06-10 e46aa927d231af83724683c7286d9db503e24cf7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace WIDESEAWCS_Common
{
    /// <summary>
    /// 表示单个木块的实体类
    /// </summary>
    public class Block
    {
        public int L { get; set; } // 长度(沿X轴)
        public int W { get; set; } // 宽度(沿Y轴)
        public int H { get; set; } // 高度(沿Z轴)
        public int X { get; set; } // X坐标(左下角)
        public int Y { get; set; } // Y坐标(左下角)
        public int Z { get; set; } // Z坐标(底部高度)
    }
 
    /// <summary>
    /// 吸盘操作信息(使用中心点坐标)
    /// </summary>
    public class SuctionInfo
    {
        public int[] PickCenter { get; set; } // 抓取中心点[x,y,z]
        public int[] PlaceCenter { get; set; } // 放置中心点[x,y,z]
        public int Rotation { get; set; }         // 实际旋转角度
 
        public Point Point { get; set; }
    }
 
    /// <summary>
    /// 放置结果输出参数
    /// </summary>
    public class PlacementResult
    {
        public List<int> VertexCoordinates { get; set; } // 8个顶点坐标(顺序:底面四角+顶面四角)
        public int[] Center { get; set; }               // 中心点坐标(x,y,z)
        public SuctionInfo SuctionInfo { get; set; }       // 吸盘操作参数
    }
 
    // 辅助类定义区------------------------------------------
 
    /// <summary>
    /// 二维坐标点(用于位置查找)
    /// </summary>
    public struct Point
    {
        public int X { get; }
        public int Y { get; }
 
        public Point(int x, int y)
        {
            X = x;
            Y = y;
        }
    }
 
    /// <summary>
    /// 支撑面描述(用于分层放置)
    /// </summary>
    public class SupportSurface
    {
        public int X { get; set; }           // 支撑面起始X坐标
        public int Y { get; set; }           // 支撑面起始Y坐标
        public int Z { get; set; }           // 支撑面高度
        public int AvailableLength { get; set; } // 可用长度(X轴方向)
        public int AvailableWidth { get; set; }  // 可用宽度(Y轴方向)
    }
 
    /// <summary>
    /// 矩形区域(用于碰撞检测)
    /// </summary>
    public class Rectangle
    {
        public int Left { get; }
        public int Top { get; }
        public int Right { get; }
        public int Bottom { get; }
 
        public Rectangle(int left, int top, int right, int bottom)
        {
            Left = left;
            Top = top;
            Right = right;
            Bottom = bottom;
        }
 
        /// <summary>
        /// 矩形相交检测(考虑间距约束)
        /// </summary>
        public bool IntersectsWith(Rectangle other)
        {
            return !(Right < other.Left ||
                   Left > other.Right ||
                   Bottom < other.Top ||
                   Top > other.Bottom);
        }
    }
}