コード例 #1
0
    // Full,//this will use create object everywere in the poly
    //Tile//this one will only fill so the next poly doesnt create any obj was created on this one
    //already
    public List <Vector3> SubDividePoly(List <Vector3> poly, int divs, H fillStyle)
    {
        List <Vector3> filled   = new List <Vector3>();
        List <Vector3> topLine  = SubDivideLine(poly, 0, 1, divs, H.X);
        List <Vector3> leftLine = SubDivideLine(poly, 1, 2, divs, H.Z);

        if (fillStyle == H.Full)
        {
            List <Vector3> botLine   = SubDivideLine(poly, 2, 3, divs, H.X);
            List <Vector3> rightLine = SubDivideLine(poly, 3, 0, divs, H.Z);
            filled = UList.AddManyListToList(botLine, rightLine, leftLine);
        }
        List <Vector3> fill = FillPolygonWrite(topLine, leftLine);

        filled = UList.AddManyListToList(filled, topLine, leftLine);
        filled = UList.AddOneListToList(filled, fill);
        float dist = 0.001f;

        //filled = UList.EliminateDuplicatesByDist(filled, dist);
        filled = filled.Distinct().ToList();
        //print(filled.Count + "filled");
        return(filled);
    }