示例#1
0
    private void TriangulateCase6Connected(
        int i, Voxel a, Voxel b, Voxel c, Voxel d)
    {
        Vector2 n1 = a.xNormal;
        Vector2 n2 = a.yNormal;

        if (IsSharpFeature(n1, n2))
        {
            Vector2 point = ComputeIntersection(a.XEdgePoint, n1, a.YEdgePoint, n2);
            if (IsInsideCell(point, a, d) &&
                IsBelowLine(point, c.position, b.position))
            {
                surface.AddPentagonBCToA(i, point);
                wall.AddABAC(i, point);
            }
            else
            {
                surface.AddQuadBCToA(i);
                wall.AddABAC(i);
            }
        }
        else
        {
            surface.AddQuadBCToA(i);
            wall.AddABAC(i);
        }

        n1 = c.xNormal;
        n2 = b.yNormal;
        if (IsSharpFeature(n1, n2))
        {
            Vector2 point = ComputeIntersection(c.XEdgePoint, n1, b.YEdgePoint, n2);
            if (IsInsideCell(point, a, d) &&
                IsBelowLine(point, b.position, c.position))
            {
                surface.AddPentagonBCToD(i, point);
                wall.AddCDBD(i, point);
                return;
            }
        }
        surface.AddQuadBCToD(i);
        wall.AddCDBD(i);
    }
 public void FillBCToA(VoxelCell cell, FeaturePoint f)
 {
     if (f.exists)
     {
         surface.AddPentagonBCToA(cell.i, f.position);
         if (!cell.a.Filled)
         {
             wall.AddABAC(cell.i, f.position);
         }
     }
     else
     {
         surface.AddQuadBCToA(cell.i);
         if (!cell.a.Filled)
         {
             wall.AddABAC(cell.i);
         }
     }
 }