1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
| namespace Yw.WinFrmUI.HydroL3d
| {
| /// <summary>
| ///
| /// </summary>
| [TypeConverter(typeof(PropertySorter))]
| public class Point3d
| {
| /// <summary>
| ///
| /// </summary>
| public Point3d() { }
|
| /// <summary>
| ///
| /// </summary>
| public Point3d(float x, float y, float z)
| {
| this.X = x;
| this.Y = y;
| this.Z = z;
| }
|
| /// <summary>
| ///
| /// </summary>
| public Point3d(double x, double y, double z)
| {
| this.X = (float)x;
| this.Y = (float)y;
| this.Z = (float)z;
| }
|
| /// <summary>
| ///
| /// </summary>
| public Point3d(Point3d rhs)
| {
| this.X = rhs.X;
| this.Y = rhs.Y;
| this.Z = rhs.Z;
| }
|
| /// <summary>
| /// x
| /// </summary>
| [DisplayName("X")]
| [PropertyOrder(1)]
| public float X { get; set; }
|
| /// <summary>
| /// y
| /// </summary>
| [DisplayName("Y")]
| [PropertyOrder(2)]
| public float Y { get; set; }
|
| /// <summary>
| /// z
| /// </summary>
| [DisplayName("Z")]
| [PropertyOrder(3)]
| public float Z { get; set; }
|
| /// <summary>
| /// 是否无效
| /// </summary>
| public bool InValid()
| {
| if (this.X.Invalid())
| {
| return true;
| }
| if (this.Y.Invalid())
| {
| return true;
| }
| if (this.Z.Invalid())
| {
| return true;
| }
| return false;
| }
|
| /// <summary>
| /// 是否有效
| /// </summary>
| public bool Valid()
| {
| return !InValid();
| }
|
| /// <summary>
| /// 距离
| /// </summary>
| 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));
| }
|
| }
| }
|
|