public void Add(AdvancedPoint directionPoint, double value) { if (AdvancedPoints.Count == 0) { AdvancedPoints.Add(directionPoint); Max = Math.Max(Max, value); Min = Math.Min(Min, value); return; } if (value > Max) { Max = Math.Max(Max, value); var neighborPoint = AdvancedPoints[AdvancedPoints.Count - 1].Point; //var neighborPointFixed = GeometryHelper.VL_GetIntersectionOnLine(neighborPoint,new XYZ(0,0,1), directionPoint.Point, directionPoint.Direction); //SeperatedLines.Add(Line.CreateBound(directionPoint.Point, neighborPointFixed)); AdvancedPoints.Add(directionPoint); } else if (value < Min) { Min = Math.Min(Min, value); var neighborPoint = AdvancedPoints[0].Point; //var neighborPointFixed = GeometryHelper.VL_GetIntersectionOnLine(neighborPoint, new XYZ(0, 0, 1), directionPoint.Point, directionPoint.Direction); //SeperatedLines.Add(Line.CreateBound(directionPoint.Point, neighborPointFixed)); AdvancedPoints.Insert(0, directionPoint); } }
/// <summary> /// 多个裁剪集合的整合 /// </summary> /// <param name="beam"></param> /// <param name="lines"></param> public SeperatePoints Merge(List <SeperatePoints> seperatePointsCollection, AdvancedPoint beamPoint0, AdvancedPoint beamPoint1) { SeperatePoints dealedPoints = new SeperatePoints(); if (seperatePointsCollection.Count() == 0) { return(dealedPoints); } seperatePointsCollection = seperatePointsCollection.OrderByDescending(c => c.Z).ToList(); var usingX = seperatePointsCollection.FirstOrDefault().AdvancedPoints[0].Point.Y == seperatePointsCollection.FirstOrDefault().AdvancedPoints[1].Point.Y; if (usingX) { foreach (var seperatePoints in seperatePointsCollection) { foreach (var point in seperatePoints.AdvancedPoints.Where(c => c.Point.X > dealedPoints.Max).OrderBy(c => c.Point.X)) { dealedPoints.Add(point, point.Point.X); } foreach (var point in seperatePoints.AdvancedPoints.Where(c => c.Point.X < dealedPoints.Min).OrderByDescending(c => c.Point.X)) { dealedPoints.Add(point, point.Point.X); } } } else { foreach (var seperatePoints in seperatePointsCollection) { foreach (var point in seperatePoints.AdvancedPoints.Where(c => c.Point.Y > dealedPoints.Max).OrderBy(c => c.Point.Y)) { dealedPoints.Add(point, point.Point.Y); } foreach (var point in seperatePoints.AdvancedPoints.Where(c => c.Point.Y < dealedPoints.Min).OrderByDescending(c => c.Point.Y)) { dealedPoints.Add(point, point.Point.Y); } } } var directionPoint = beamPoint0; if (dealedPoints.AdvancedPoints.FirstOrDefault(c => c.Point.VL_XYEqualTo(directionPoint.Point)) == null) { if (usingX) { dealedPoints.Add(directionPoint, directionPoint.Point.X); } else { dealedPoints.Add(directionPoint, directionPoint.Point.Y); } } directionPoint = beamPoint1; if (dealedPoints.AdvancedPoints.FirstOrDefault(c => c.Point.VL_XYEqualTo(directionPoint.Point)) == null) { if (usingX) { dealedPoints.Add(directionPoint, directionPoint.Point.X); } else { dealedPoints.Add(directionPoint, directionPoint.Point.Y); } } return(dealedPoints); }