예제 #1
0
    private static void circle_recurse(Vector3 center, Vector3 circleCenter, float radius, MeshNode node)
    {
        List <MeshNode> edgesCopy = new List <MeshNode>(node.edges);

        node.visited = true;
        for (int i = 0; i < edgesCopy.Count; i++)
        {
            if (edgesCopy[i].visited == false)
            {
                Vector3 position = node.GetEdgeCenter(edgesCopy[i]);
                position = circleCenter + (position - circleCenter) *
                           Mathf.Abs(radius / ((position - circleCenter).magnitude));
                node.SplitEdge(edgesCopy[i], position, position - center).visited = true;
            }
        }

        for (int i = 0; i < edgesCopy.Count; i++)
        {
            if (edgesCopy[i].visited == false)
            {
                circle_recurse(center, circleCenter, radius, edgesCopy[i]);
            }
        }
    }