| | |
| | | return _parters.Exists(x => x.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取包围盒 |
| | | /// </summary> |
| | | public BoundingBoxL3d GetBoundingBox() |
| | | { |
| | | var minX = float.MaxValue; |
| | | var minY = float.MaxValue; |
| | | var minZ = float.MaxValue; |
| | | var maxX = float.MinValue; |
| | | var maxY = float.MinValue; |
| | | var maxZ = float.MinValue; |
| | | |
| | | foreach (var node in this.Nodes) |
| | | { |
| | | minX = Math.Min(minX, node.Position.X); |
| | | minY = Math.Min(minY, node.Position.Y); |
| | | minZ = Math.Min(minZ, node.Position.Z); |
| | | maxX = Math.Max(maxX, node.Position.X); |
| | | maxY = Math.Max(maxY, node.Position.Y); |
| | | maxZ = Math.Max(maxZ, node.Position.Z); |
| | | } |
| | | |
| | | return new BoundingBoxL3d() |
| | | { |
| | | Min = new PointL3d(minX, minY, minZ), |
| | | Max = new PointL3d(maxX, maxY, maxZ) |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取中心点 |
| | | /// </summary> |
| | | public PointL3d GetCenter(BoundingBoxL3d boundingBox) |
| | | { |
| | | if (boundingBox == null) |
| | | { |
| | | boundingBox = GetBoundingBox(); |
| | | } |
| | | return boundingBox.GetCenter(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |