Ejemplo n.º 1
0
 /// <summary>
 /// Calculate the border equations for faster computation when checking valid indices
 /// </summary>
 private void GetBorderEquations()
 {
     // Calculate border euqations
     for (int i = 0; i < cornerPoints.Count; i++)
     {
         Point p1 = cornerPoints[i];
         Point p2 = cornerPoints[(i + 1) % cornerPoints.Count];
         borderEqs[i] = new lineEq(p1, p2);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ActionArea()
        {
            InitializeComponent();
            borderEqs = new lineEq[4];
            this.cornerPoints = new PointCollection();
            this.cornerPoints.Add(cPoint(0, 0)); // top left
            this.cornerPoints.Add(cPoint(0, 200)); // bot left
            this.cornerPoints.Add(cPoint(140, 200)); // bot right
            this.cornerPoints.Add(cPoint(140, 0)); // top right

            for (int i = 0; i < this.cornerPoints.Count; i++)
            {
                Canvas.SetLeft(this.actionCanvas.Children[i + ellipseIndex], this.cornerPoints[i].X - ellipseWidth / 2);
                Canvas.SetTop(this.actionCanvas.Children[i + ellipseIndex], this.cornerPoints[i].Y - ellipseWidth / 2);
            }

            this.DataContext = this;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Calculate the border equations for faster computation when checking valid indices
 /// </summary>
 private void GetBorderEquations()
 {
     // Calculate border euqations
     for (int i = 0; i < cornerPoints.Count; i++)
     {
         Point p1 = cornerPoints[i];
         Point p2 = cornerPoints[(i + 1) % cornerPoints.Count];
         borderEqs[i] = new lineEq(p1, p2);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads the action area if there's one saved from previous definition
        /// </summary>
        /// <param name="topLeft"></param>
        /// <param name="botLeft"></param>
        /// <param name="botRight"></param>
        /// <param name="topRight"></param>
        public void LoadActionArea(Point topLeft, Point botLeft, Point botRight, Point topRight)
        {
            borderEqs = new lineEq[4];
            this.cornerPoints = new PointCollection();
            this.cornerPoints.Add(topLeft); // top left
            this.cornerPoints.Add(botLeft); // bot left
            this.cornerPoints.Add(botRight); // bot right
            this.cornerPoints.Add(topRight); // top right

            for (int i = 0; i < this.cornerPoints.Count; i++)
            {
                Canvas.SetLeft(this.actionCanvas.Children[i + ellipseIndex], this.cornerPoints[i].X - ellipseWidth / 2);
                Canvas.SetTop(this.actionCanvas.Children[i + ellipseIndex], this.cornerPoints[i].Y - ellipseWidth / 2);
            }

            this.DataContext = this;
        }