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;
|
}
|
}
|
}
|