using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEAWCS_DTO.PlacedBlockDTO
{
///
/// 已放置货物信息类
/// 记录每个货物的位置和尺寸信息
/// 坐标系说明:位置点为货物的左下前角坐标
///
public class PlacedBlock
{
/// 货物左下前角坐标
public Point3D Position { get; }
/// 沿X轴方向长度(毫米)
public int Length { get; }
/// 沿Y轴方向宽度(毫米)
public int Width { get; }
/// 沿Z轴方向高度(毫米)
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;
}
}
}