RectArea() public method

public RectArea ( Rect r ) : float
r Rect
return float
Beispiel #1
0
        private static int ExpansionRequired(IntRect r, IntRect r2)
        {
            int num  = Math.Min(r.xmin, r2.xmin);
            int num2 = Math.Max(r.xmax, r2.xmax);
            int num3 = Math.Min(r.ymin, r2.ymin);
            int num4 = Math.Max(r.ymax, r2.ymax);

            return((num2 - num) * (num4 - num3) - BBTree.RectArea(r));
        }
Beispiel #2
0
        private static float ExpansionRequired(Rect r, Rect r2)
        {
            float num  = Math.Min(r.xMin, r2.xMin);
            float num2 = Math.Max(r.xMax, r2.xMax);
            float num3 = Math.Min(r.yMin, r2.yMin);
            float num4 = Math.Max(r.yMax, r2.yMax);

            return((num2 - num) * (num4 - num3) - BBTree.RectArea(r));
        }
Beispiel #3
0
        public void Insert(MeshNode node)
        {
            int box = this.GetBox(node);

            if (box == 0)
            {
                return;
            }
            BBTree.BBTreeBox bBTreeBox = this.arr[box];
            int num = 0;

            BBTree.BBTreeBox bBTreeBox2;
            while (true)
            {
                bBTreeBox2      = this.arr[num];
                bBTreeBox2.rect = BBTree.ExpandToContain(bBTreeBox2.rect, bBTreeBox.rect);
                if (bBTreeBox2.node != null)
                {
                    break;
                }
                this.arr[num] = bBTreeBox2;
                int num2 = BBTree.ExpansionRequired(this.arr[bBTreeBox2.left].rect, bBTreeBox.rect);
                int num3 = BBTree.ExpansionRequired(this.arr[bBTreeBox2.right].rect, bBTreeBox.rect);
                if (num2 < num3)
                {
                    num = bBTreeBox2.left;
                }
                else if (num3 < num2)
                {
                    num = bBTreeBox2.right;
                }
                else
                {
                    num = ((BBTree.RectArea(this.arr[bBTreeBox2.left].rect) >= BBTree.RectArea(this.arr[bBTreeBox2.right].rect)) ? bBTreeBox2.right : bBTreeBox2.left);
                }
            }
            bBTreeBox2.left = box;
            int box2 = this.GetBox(bBTreeBox2.node);

            bBTreeBox2.right = box2;
            bBTreeBox2.node  = null;
            this.arr[num]    = bBTreeBox2;
        }