Пример #1
0
    private void TriangulateCase9Connected(
        int i, Voxel a, Voxel b, Voxel c, Voxel d)
    {
        Vector2 n1 = a.xNormal;
        Vector2 n2 = b.yNormal;

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

        n1 = c.xNormal;
        n2 = a.yNormal;
        if (IsSharpFeature(n1, n2))
        {
            Vector2 point = ComputeIntersection(c.XEdgePoint, n1, a.YEdgePoint, n2);
            if (IsInsideCell(point, a, d) &&
                IsBelowLine(point, d.position, a.position))
            {
                surface.AddPentagonADToC(i, point);
                wall.AddACCD(i, point);
                return;
            }
        }
        surface.AddQuadADToC(i);
        wall.AddACCD(i);
    }
Пример #2
0
 public void FillADToB(VoxelCell cell, FeaturePoint f)
 {
     if (f.exists)
     {
         surface.AddPentagonADToB(cell.i, f.position);
         if (!cell.b.Filled)
         {
             wall.AddBDAB(cell.i, f.position);
         }
     }
     else
     {
         surface.AddQuadADToB(cell.i);
         if (!cell.b.Filled)
         {
             wall.AddBDAB(cell.i);
         }
     }
 }