Esempio n. 1
0
        /// 頂点を追加します。
        public void Push(Vertex a, TSOSubMesh sub)
        {
            int        x    = GetX(a.position.X);
            int        y    = GetY(a.position.Y);
            int        z    = GetZ(a.position.Z);
            UniqueCell cell = GetCell(x, y, z);

            cell.Push(a, sub);
        }
Esempio n. 2
0
 /// <summary>
 /// セルを生成します。
 /// </summary>
 /// <param name="cluster">クラスタ</param>
 /// <param name="x">x値</param>
 /// <param name="y">y値</param>
 /// <param name="z">z値</param>
 /// <param name="contains_zero_x">x軸を含むか</param>
 public UniqueCell(Cluster cluster, int x, int y, int z, bool contains_zero_x)
 {
     this.cluster         = cluster;
     this.x               = x;
     this.y               = y;
     this.z               = z;
     this.contains_zero_x = contains_zero_x;
     this.vertices        = new List <UniqueVertex>();
     this.opposite_cell   = null;
 }
Esempio n. 3
0
 /// <summary>
 /// 指定位置に最も近い同一視頂点を見つけます。
 /// </summary>
 /// <param name="position">位置</param>
 /// <param name="cell">探索対象セル</param>
 /// <param name="found">前回見つけた頂点</param>
 /// <param name="min_len_sq">前回見つけた頂点までの距離の平方</param>
 /// <returns></returns>
 public static UniqueVertex FindVertex(Vector3 position, UniqueCell cell, UniqueVertex found, ref float min_len_sq)
 {
     if (cell != null)
     {
         float        len_sq;
         UniqueVertex v = cell.FindVertexAt(position, out len_sq);
         if (min_len_sq > len_sq)
         {
             min_len_sq = len_sq;
             found      = v;
         }
     }
     return(found);
 }
Esempio n. 4
0
        /// 指定座標にあるセルを得ます。
        public UniqueCell GetCell(int x, int y, int z)
        {
            UniqueCell cell = null;

            try
            {
                if (cells[x, y, z] == null)
                {
                    cells[x, y, z] = new UniqueCell(this, x, y, z, x == GetX(0.0f));
                }
                cell = cells[x, y, z];
            }
            catch (IndexOutOfRangeException)
            {
            }
            return(cell);
        }