Example #1
0
 public static float getPercentBB(BBox[] boxes, int size)
 {
     int sum = 0;
     for (int i = 0; i < size; i++)
     {
          sum+= boxes[i].isValid();
     }
     return (float)sum/size * 100;
 }
Example #2
0
 public static unsafe float getPercentBBInterop(BBox[] boxes, int size)
 {
     float result;
     fixed (BBox* p = boxes)
     {
         result = nativef((IntPtr)p, size);
     }
     return result;
 }
Example #3
0
        public float x1, y1, x2, y2; //Corner points of the rectangle

        #region Methods

        //Initialize array
        public static BBox[] getBBArray(int n)
        {
            BBox[] arr = new BBox[n];
            Random r = new Random();
            for (int i = 0; i < arr.Length; i++)
            {
                arr[i].x1 = (float)r.NextDouble() * 2;
                arr[i].y1 = (float)r.NextDouble() * 2;
                arr[i].x2 = (float)r.NextDouble() * 2;
                arr[i].y2 = (float)r.NextDouble() * 2;
            }
            return arr;
        }