namespace Yw.WinFrmUI.HydroL3d { /// /// /// [TypeConverter(typeof(PropertySorter))] public class Point3d { /// /// /// public Point3d() { } /// /// /// public Point3d(float x, float y, float z) { this.X = x; this.Y = y; this.Z = z; } /// /// /// public Point3d(double x, double y, double z) { this.X = (float)x; this.Y = (float)y; this.Z = (float)z; } /// /// /// public Point3d(Point3d rhs) { this.X = rhs.X; this.Y = rhs.Y; this.Z = rhs.Z; } /// /// x /// [DisplayName("X")] [PropertyOrder(1)] public float X { get; set; } /// /// y /// [DisplayName("Y")] [PropertyOrder(2)] public float Y { get; set; } /// /// z /// [DisplayName("Z")] [PropertyOrder(3)] public float Z { get; set; } /// /// 是否无效 /// public bool InValid() { if (this.X.Invalid()) { return true; } if (this.Y.Invalid()) { return true; } if (this.Z.Invalid()) { return true; } return false; } /// /// 是否有效 /// public bool Valid() { return !InValid(); } /// /// 距离 /// public float Distance(Point3d other) { if (other == null) { return default; } return MathF.Sqrt(MathF.Pow(this.X - other.X, 2) + MathF.Pow(this.Y - other.Y, 2) + MathF.Pow(this.Z - other.Z, 2)); } } }