■ 정점(Vertex) 딕셔너리 구하기

------------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;

using System.Windows.Media.Media3D;

 

#region 정점 딕셔너리 구하기 - GetVertexDictionary(collection)

 

/// <summary>

/// 정점 딕셔너리 구하기

/// </summary>

/// <param name="collection">포인트 3D 컬렉션</param>

/// <returns>정점 딕셔너리</returns>

public Dictionary<Point3D, List<int>> GetVertexDictionary(Point3DCollection collection)

{

    Dictionary<Point3D, List<int>> pointDictionary = new Dictionary<Point3D, List<int>>();

 

    for(int i = 0; i < collection.Count; i++)

    {

        Point3D point = collection[i];

 

        if(pointDictionary.ContainsKey(point))

        {

            List<int> indexList = pointDictionary[point];

 

            indexList.Add(i);

        }

        else

        {

            List<int> indexList = new List<int>();

 

            indexList.Add(i);

 

            pointDictionary.Add(point, indexList);

        }

    }

 

    return pointDictionary;

}

 

#endregion

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker