Exemple #1
0
 public bool IsCover(Line line)
 {
     foreach (var SubOutLine in OutLines)
     {
         if (SubOutLine.IsCover(line) != CoverType.Disjoint)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
        /// <summary>
        /// 获得拆分点
        /// </summary>
        /// <returns></returns>
        public SeperatePoints GetFitLines(Line beamLineZ0)
        {
            var intersectLineZ0s = LineZ0s.Where(c => c.VL_IsIntersect(beamLineZ0));
            //这里计算出了裁剪点,但这里是Z0面的交点
            SeperatePoints result = new SeperatePoints();

            foreach (var intersectLineZ0 in intersectLineZ0s)
            {
                var pointZ0s   = intersectLineZ0.VL_GetIntersectedOrContainedPoints(beamLineZ0);
                var orientLine = Lines.First(c => c.GetEndPoint(0).VL_XYEqualTo(intersectLineZ0.GetEndPoint(0)) && c.GetEndPoint(1).VL_XYEqualTo(intersectLineZ0.GetEndPoint(1)));
                result.AdvancedPoints.AddRange(orientLine.VL_GetZLineIntersection(pointZ0s, IsSolid, beamLineZ0));
            }
            ////裁剪点需回归到面板
            //foreach (var point in points)
            //{
            //    var intersectPoint = Points.FirstOrDefault(p => p.XYEqualTo(point));
            //    if (intersectPoint != null)
            //        result.Points.Add(intersectPoint);
            //    else
            //    {
            //        var unboundLine = Line.CreateBound(point, point + new XYZ(0, 0, 1));
            //        unboundLine.MakeUnbound();
            //        IntersectionResultArray faceIntersect;
            //        Face.Intersect(unboundLine, out faceIntersect);
            //        result.Points.Add(faceIntersect.get_Item(0).XYZPoint);
            //    }
            //}
            //result.Points.AddRange(points);
            //result.Points.AddRange(points.Select(c => new XYZ(c.X, c.Y, Points.FirstOrDefault(p => p.XYEqualTo(c)).Z)));
            foreach (var SubOutLine in SubOutLines)
            {
                var coverType = SubOutLine.IsCover(beamLineZ0);
                if (coverType != CoverType.Disjoint)
                {
                    result.AdvancedPoints.AddRange(SubOutLine.GetFitLines(beamLineZ0).AdvancedPoints);
                }
            }
            return(result);
        }
Exemple #3
0
        ///// <summary>
        ///// 检测轮廓是否相交或包含 有限线段
        ///// </summary>
        ///// <param name="outLine"></param>
        ///// <returns></returns>
        //public bool IsCover(XYZ pointZ0)
        //{
        //    foreach (var subOutLine in OutLines)
        //    {
        //        if (subOutLine.GetContainer(pointZ0) != null)
        //        {
        //            return true;
        //        }
        //    }
        //    return false;
        //}

        /// <summary>
        /// 获得拆分点
        /// </summary>
        /// <returns></returns>
        public SeperatePoints GetFitLines(Line beamLineZ0)
        {
            SeperatePoints fitLines = new SeperatePoints();
            var            p0       = beamLineZ0.GetEndPoint(0);
            var            p1       = beamLineZ0.GetEndPoint(1);

            foreach (var SubOutLine in OutLines)
            {
                var coverType = SubOutLine.IsCover(beamLineZ0);
                if (coverType != CoverType.Disjoint)
                {
                    fitLines.AdvancedPoints.AddRange(SubOutLine.GetFitLines(beamLineZ0).AdvancedPoints);
                }
                //线的端点增加 注意检测是否已存在
                var point = p0;
                if (fitLines.AdvancedPoints.FirstOrDefault(c => c.Point.VL_XYEqualTo(point)) == null)
                {
                    var triangle = SubOutLine.GetContainer(point);
                    if (triangle != null)
                    {
                        var directOutLine = SubOutLine.GetContainedOutLine(point);
                        fitLines.AdvancedPoints.Add(new AdvancedPoint(VLGeometryHelper.GetIntersection(triangle, point, new XYZ(0, 0, 1)), beamLineZ0.Direction, directOutLine.IsSolid));
                    }
                }
                point = p1;
                if (fitLines.AdvancedPoints.FirstOrDefault(c => c.Point.VL_XYEqualTo(point)) == null)
                {
                    var triangle = SubOutLine.GetContainer(point);
                    if (triangle != null)
                    {
                        var directOutLine = SubOutLine.GetContainedOutLine(point);
                        fitLines.AdvancedPoints.Add(new AdvancedPoint(VLGeometryHelper.GetIntersection(triangle, point, new XYZ(0, 0, 1)), beamLineZ0.Direction, directOutLine.IsSolid));
                    }
                }
            }
            return(fitLines);
        }