Ejemplo n.º 1
0
        void FindTriKeys(Triangle Tri, ref key_list_rec key_list)
        {
            double xmin, ymin, xmax, ymax;
            double x, y;

            xmin = 1E100;
            xmax = -1E100;
            ymin = 1E100;
            ymax = -1E100;

            //  { Find the enclosing rectangle }
            for (int side = 0; side < 3; side++)
            {
                x = Tri.Vertices[side].X;
                y = Tri.Vertices[side].Y;
                if (x < xmin)
                {
                    xmin = x;
                }
                if (x > xmax)
                {
                    xmax = x;
                }
                if (y < ymin)
                {
                    ymin = y;
                }
                if (y > ymax)
                {
                    ymax = y;
                }
            }

            calc_rectangle_keys(xmin, ymin, xmax, ymax, ref key_list);
        }
Ejemplo n.º 2
0
        void AddTriangle(Triangle Tri, int Index)
        {
            key_list_rec key_list = key_list_rec.Init();

            FindTriKeys(Tri, ref key_list);

            for (int k = 0; k < key_list.num_keys; k++)
            {
                add_entity_key(key_list.key[k], Index);

                int total = BATree.Select(x => x.Count).Sum();

                writer.WriteLine($"Added ent {Index}, with {key_list.num_keys} keys, using key {key_list.key[k]}, sum elements = {total}");

// Check nothing bad happened (DEBUG ONLY)

/*                foreach (var block in BATree)
 *              {
 *                  for (int c = 0; c < block.Count; c++)
 *                  {
 *                      if (block.element[c].entity_index == 0 && block.element[c].key == 0)
 *                      {
 *                          c = c;
 *                      }
 *
 *                      if (c > 0 && block.element[c-1].key > block.element[c].key)
 *                      {
 *                          c = c;
 *                      }
 *                  }
 *              }*/
            }
        }
Ejemplo n.º 3
0
 void FindTriKeys(int index, ref key_list_rec key_list)
 //{ Finds the list of keys associated with the given triangle }
 //{ Assumes the current axes are east_ and north_ }
 {
     FindTriKeys(TTM.Triangles[index], ref key_list);
 }
Ejemplo n.º 4
0
 public override void find_tri_keys(object triangle, ref key_list_rec key_list)
 {
     FindTriKeys((Triangle)triangle, ref key_list);
 }