AklToussaintHeuristic() 공개 정적인 메소드

public static AklToussaintHeuristic ( List positions ) : List
positions List
리턴 List
예제 #1
0
    // Update is called once per frame
    void OnDrawGizmosSelected()
    {
        if (transform.parent != null && transform.parent.GetComponent <ConvexHullTest>() != null)
        {
            transform.parent.GetComponent <ConvexHullTest>().OnDrawGizmosSelected();
            return;
        }
        Gizmos.color = Color.white;
        if (points == null || points.Length == 0 || points[0] == null || forceNew)
        {
            // create random points
            CreateRandomPoints();
        }
        List <Vector3> positions = new List <Vector3>();

        foreach (var p in points)
        {
            positions.Add(p.position);
            Gizmos.DrawSphere(p.position, 0.1f);
        }

        var culled = ConvexHull.AklToussaintHeuristic(positions);

        foreach (var p in culled)
        {
            Gizmos.color = Color.yellow;
            Gizmos.DrawSphere(p, 0.2f);
        }
        res          = ConvexHull.GiftWrapping(culled);
        Gizmos.color = Color.white;
        for (int i = 0; i < res.Count; i++)
        {
            Gizmos.DrawLine(res[i], res[(i + 1) % res.Count]);
        }
    }