namespace Yw.WinFrmUI.HydroL3d
|
{
|
/// <summary>
|
///
|
/// </summary>
|
[TypeConverter(typeof(PropertySorter))]
|
public class BoundingBox3d
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public BoundingBox3d() { }
|
|
/// <summary>
|
///
|
/// </summary>
|
public BoundingBox3d(Point3d min, Point3d max)
|
{
|
this.Min = new Point3d(min);
|
this.Max = new Point3d(max);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
[DisplayName("Min")]
|
[PropertyOrder(1)]
|
public Point3d Min { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
[DisplayName("Max")]
|
[PropertyOrder(2)]
|
public Point3d Max { get; set; }
|
|
/// <summary>
|
/// 获取中心
|
/// </summary>
|
public Point3d GetCenter()
|
{
|
return new Point3d()
|
{
|
X = (this.Max.X + this.Min.X) / 2f,
|
Y = (this.Max.Y + this.Min.Y) / 2f,
|
Z = (this.Max.Z + this.Min.Z) / 2f
|
};
|
}
|
|
/// <summary>
|
/// 是否包含
|
/// </summary>
|
public bool Contains(Point3d pt)
|
{
|
if (pt.X > this.Max.X || pt.X < this.Min.X)
|
{
|
return false;
|
}
|
if (pt.Y > this.Max.Y || pt.Y < this.Min.Y)
|
{
|
return false;
|
}
|
//if (pt.Z > this.Max.Z || pt.Z < this.Min.Z)
|
//{
|
// return false;
|
//}
|
|
return true;
|
}
|
|
}
|
}
|