namespace Yw.WinFrmUI.HydroL3d { /// /// /// [TypeConverter(typeof(PropertySorter))] public class BoundingBox3d { /// /// /// public BoundingBox3d() { } /// /// /// public BoundingBox3d(Point3d min, Point3d max) { this.Min = new Point3d(min); this.Max = new Point3d(max); } /// /// /// [DisplayName("Min")] [PropertyOrder(1)] public Point3d Min { get; set; } /// /// /// [DisplayName("Max")] [PropertyOrder(2)] public Point3d Max { get; set; } /// /// 获取中心 /// 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 }; } /// /// 是否包含 /// 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; } } }