コード例 #1
0
ファイル: World.cs プロジェクト: Ninjars/unity-islands
        public int indexOfClosestCenter(int startIndex, Vector3 point, bool allowUnclipped)
        {
            Center c = centers[startIndex];

            return(indexOfClosestCenter(c, point, allowUnclipped));
        }
コード例 #2
0
        private static Edge makeEdge(bool isBorder, Corner corner0, Corner corner1, Center center0, Center center1)
        {
            Edge edge = new Edge(isBorder, corner0, corner1, center0, center1);

            if (center0 != null && center1 != null)
            {
                center0.AddNeighbour(center1);
                center1.AddNeighbour(center0);
            }
            corner0.AddEdge(edge);
            corner0.AddCenter(center0);
            corner0.AddCenter(center1);
            corner0.AddAdjacent(corner1);
            corner0.isBorder = isBorder;

            corner1.AddEdge(edge);
            corner1.AddCenter(center0);
            corner1.AddCenter(center1);
            corner1.AddAdjacent(corner0);
            corner1.isBorder = isBorder;

            if (center0 != null)
            {
                center0.AddEdge(edge);
                center0.isBorder = isBorder;
            }
            if (center1 != null)
            {
                center1.AddEdge(edge);
                center1.isBorder = isBorder;
            }
            return(edge);
        }