예제 #1
0
 public override bool IsInside(DominoInCanvas dic, Rect boundingBox, bool includeBoundary)
 {
     if (IsInsideBoundingBox(boundingBox, dic, includeBoundary))
     {
         var insidePoly = dic.canvasPoints.Count(x => IsPointInPolygon(points, new System.Windows.Point(x.X, x.Y)));
         return(CheckBoundary(dic, insidePoly));
     }
     return(false);
 }
예제 #2
0
        public override bool IsInside(DominoInCanvas dic, Rect boundingBox, bool includeBoundary)
        {
            var radius = boundingBox.Width / 2;
            var center = new System.Windows.Point(boundingBox.X + radius, boundingBox.Y + radius);

            if (IsInsideBoundingBox(boundingBox, dic, includeBoundary))
            {
                var insideCircle = dic.canvasPoints.Count(x =>
                                                          Math.Sqrt((x.X - center.X) * (x.X - center.X) + (x.Y - center.Y) * (x.Y - center.Y)) < radius);
                return(CheckBoundary(dic, insideCircle));
            }
            return(false);
        }
예제 #3
0
        private void Dic_MouseDown(object sender, MouseButtonEventArgs e)
        {
            DominoInCanvas dic = (DominoInCanvas)sender;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (IsSelected(dic.idx))
                {
                    SelectionTool.Select(new int[] { dic.idx }, true);
                }
            }
            else if (e.RightButton == MouseButtonState.Pressed)
            {
                SelectionTool.Select(new int[] { dic.idx }, false);
            }
        }
예제 #4
0
 public bool IsInsideBoundingBox(Rect BoundingBox, DominoInCanvas dic, bool includeBoundary)
 {
     if (includeBoundary)
     {
         return(dic.canvasPoints.Max(x => x.X) > BoundingBox.Left &&
                dic.canvasPoints.Min(x => x.X) < BoundingBox.Right &&
                dic.canvasPoints.Min(x => x.Y) < BoundingBox.Bottom &&
                dic.canvasPoints.Max(x => x.Y) > BoundingBox.Top);
     }
     else
     {
         return(dic.canvasPoints.Min(x => x.X) > BoundingBox.Left &&
                dic.canvasPoints.Max(x => x.X) < BoundingBox.Right &&
                dic.canvasPoints.Max(x => x.Y) < BoundingBox.Bottom &&
                dic.canvasPoints.Min(x => x.Y) > BoundingBox.Top);
     }
 }
예제 #5
0
 public bool CheckBoundary(DominoInCanvas dic, int pointsInsideSelection)
 {
     if (IncludeBoundary)
     {
         if (pointsInsideSelection > 0)
         {
             return(true);
         }
     }
     else
     {
         if (pointsInsideSelection == dic.canvasPoints.Length)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 public override bool IsInside(DominoInCanvas dic, Rect boundingBox, bool includeBoundary)
 {
     return(IsInsideBoundingBox(boundingBox, dic, includeBoundary));
 }
예제 #7
0
 public abstract bool IsInside(DominoInCanvas dic, Rect boundingBox, bool includeBoundary);