Пример #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);
    }
Пример #2
0
 public void FillBCToD(VoxelCell cell, FeaturePoint f)
 {
     if (f.exists)
     {
         surface.AddPentagonBCToD(cell.i, f.position);
         if (!cell.d.Filled)
         {
             wall.AddCDBD(cell.i, f.position);
         }
     }
     else
     {
         surface.AddQuadBCToD(cell.i);
         if (!cell.d.Filled)
         {
             wall.AddCDBD(cell.i);
         }
     }
 }