src/AircraftTrajectories/Models/TemporalGrid/Contours/Contour.cs
/// <summary>
/// Generates the contours by finding closed circles
/// </summary>
/// <param name="vgrid"></param>
/// <param name="hgrid"></param>
/// <returns></returns>
Generates the contours by finding closed circles
Generates the contours by finding closed circles
private static IEnumerable<Contour> GenerateContours(IEnumerable<ContourPoint>[][] vgrid, IEnumerable<ContourPoint>[][] hgrid)
        {
            foreach (var l in vgrid)
            {
                foreach (var i in l[0].Where(i => i.Direction == ContourDirection.East))
                {
                    yield return new Contour(i, vgrid, hgrid, false);
                }
                foreach (var i in l.Last().Where(i => i.Direction == ContourDirection.West))
                {
                    yield return new Contour(i, vgrid, hgrid, false);
                }
            }
            foreach (var i in hgrid[0].SelectMany(l => l.Where(i => i.Direction == ContourDirection.South)))
            {
                yield return new Contour(i, vgrid, hgrid, false);
            }
            foreach (var i in hgrid.Last().SelectMany(l => l.Where(i => i.Direction == ContourDirection.North)))
            {
                yield return new Contour(i, vgrid, hgrid, false);
            }
            for (int y = 1; y < vgrid.Length - 1; y++)
            {
                for (int x = 1; x < vgrid[y].Length - 1; x++)
                {
                    foreach (var i in vgrid[y][x].Where(i => i.Parent == null))
                    {
                        yield return new Contour(i, vgrid, hgrid, true);
                    }
                }
            }
        }
private static IEnumerable < Contour > GenerateContours ( IEnumerable < ContourPoint > [ ] [ ] vgrid , IEnumerable < ContourPoint > [ ] [ ] hgrid ) { foreach ( var l in vgrid ) { foreach ( var i in l [ 0 ] . Where ( i => i . Direction == ContourDirection . East ) ) { yield return new Contour ( i , vgrid , hgrid , false ) ; } foreach ( var i in l . Last ( ) . Where ( i => i . Direction == ContourDirection . West ) ) { yield return new Contour ( i , vgrid , hgrid , false ) ; } } foreach ( var i in hgrid [ 0 ] . SelectMany ( l => l . Where ( i => i . Direction == ContourDirection . South ) ) ) { yield return new Contour ( i , vgrid , hgrid , false ) ; } foreach ( var i in hgrid . Last ( ) . SelectMany ( l => l . Where ( i => i . Direction == ContourDirection . North ) ) ) { yield return new Contour ( i , vgrid , hgrid , false ) ; } for ( int y = 1 ; y < vgrid . Length - 1 ; y ++ ) { for ( int x = 1 ; x < vgrid [ y ] . Length - 1 ; x ++ ) { foreach ( var i in vgrid [ y ] [ x ] . Where ( i => i . Parent == null ) ) { yield return new Contour ( i , vgrid , hgrid , true ) ; } } } }
Generates the contours by finding closed circles
Generates the contours by finding closed circles
// iterate the frame // find circles
None
vgrid
IEnumerable<ContourPoint>[][]
None
hgrid
IEnumerable<ContourPoint>[][]
None