示例#1
0
    public static LevelSkeleton ToBasementSkeleton(this LevelSkeleton skeleton)
    {
        var basementSkeleton = new LevelSkeleton();

        var newLines = skeleton.ToGraph().AlgorithmByPrim().Edges.ToList().Select(_ =>
        {
            return(new SkeletonLine(_.Vertexes.ToList()[0].Data, _.Vertexes.ToList()[1].Data, new EntityType(Color.blue, "Basement")));
        });

        basementSkeleton.AddLines(newLines);

        return(basementSkeleton);
    }
示例#2
0
    public static List <List <SkeletonLine> > GetCycles(this LevelSkeleton skeleton)
    {
        var cycles = new List <List <SkeletonLine> >();

        var graphCycles = skeleton.ToGraph().GetCycles();

        foreach (var graphCycle in graphCycles)
        {
            var cycle = new List <SkeletonLine>();
            graphCycle.ForEach(edge => cycle.Add(skeleton.Lines.First(_ => _.ContainsSkeletonPoint(edge.VertexA.Data) && _.ContainsSkeletonPoint(edge.VertexB.Data))));

            if (!cycles.Any(_ => _.IsCycleEquals(cycle)))
            {
                cycles.Add(cycle);
            }
        }

        return(cycles);
    }