1
z8018
2025-04-16 1f361850d35ba47225951efbc49d592eea685cf8
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace WIDESEAWCS_DTO.PlacedBlockDTO
{
    /// <summary>
    /// 已放置货物信息类
    /// 记录每个货物的位置和尺寸信息
    /// 坐标系说明:位置点为货物的左下前角坐标
    /// </summary>
    public class PlacedBlock
    {
        /// <summary>货物左下前角坐标</summary>
        public Point3D Position { get; }
 
        /// <summary>沿X轴方向长度(毫米)</summary>
        public int Length { get; }
 
        /// <summary>沿Y轴方向宽度(毫米)</summary>
        public int Width { get; }
 
        /// <summary>沿Z轴方向高度(毫米)</summary>
        public int Height { get; }
 
        public PlacedBlock(Point3D position, int length, int width, int height)
        {
            Position = position;
            Length = length;
            Width = width;
            Height = height;
        }
 
        public bool Intersects(PlacedBlock other)
        {
            return Position.X < other.Position.X + other.Length &&
                   Position.X + Length > other.Position.X &&
                   Position.Y < other.Position.Y + other.Width &&
                   Position.Y + Width > other.Position.Y &&
                   Position.Z < other.Position.Z + other.Height &&
                   Position.Z + Height > other.Position.Z;
        }
    }
}