private void CutterIntersect()
        {
            MyPoint cutterStartPointDiagonal = MyUtils.GetStartPointDiagonal(Cutter.StartPoint, Cutter.EndPoint) / Scale.Value;
            MyPoint cutterEndPointDiagonal   = MyUtils.GetEndPointDiagonal(Cutter.StartPoint, Cutter.EndPoint) / Scale.Value;
            var     connects = Connects.Where(x => MyUtils.Intersect(MyUtils.GetStartPointDiagonal(x.StartPoint, x.EndPoint), MyUtils.GetEndPointDiagonal(x.StartPoint, x.EndPoint),
                                                                     cutterStartPointDiagonal, cutterEndPointDiagonal));

            foreach (var connect in Connects)
            {
                connect.Selected = false;
            }

            foreach (var connect in connects)
            {
                connect.Selected = MyUtils.ComputeIntersections(connect.StartPoint, connect.Point1, connect.Point2, connect.EndPoint, Cutter.StartPoint, Cutter.EndPoint);
            }
        }
Example #2
0
        private void CutterIntersect()
        {
            //MyPoint cutterStartPoint = Cutter.StartPoint / Scale.Value;
            //MyPoint cutterEndPoint = Cutter.EndPoint / Scale.Value;
            MyPoint cutterStartPoint = Cutter.StartPoint;
            MyPoint cutterEndPoint   = Cutter.EndPoint;
            //some optimizations
            var connects = Connects.Where(x => MyUtils.Intersect(MyUtils.GetStartPointDiagonal(x.StartPoint, x.EndPoint), MyUtils.GetEndPointDiagonal(x.StartPoint, x.EndPoint),
                                                                 MyUtils.GetStartPointDiagonal(Cutter.StartPoint, Cutter.EndPoint), MyUtils.GetEndPointDiagonal(Cutter.StartPoint, Cutter.EndPoint)));

            //var connects = Connects;
            foreach (var connect in Connects)
            {
                connect.Selected = false;
            }

            foreach (var connect in connects)
            {
                connect.Selected = MyUtils.ComputeIntersections(connect.StartPoint, connect.Point1, connect.Point2, connect.EndPoint, Cutter.StartPoint, Cutter.EndPoint);
            }
        }