Пример #1
0
    private static List <Segment2D> toEdgeList(Rect aRect, List <Segment2D> boundSegments)
    {
        var result     = new List <Segment2D>();
        var cornerList = new List <Vector2>()
        {
            new Vector2(aRect.xMin, aRect.yMin),
            new Vector2(aRect.xMin, aRect.yMax),
            new Vector2(aRect.xMax, aRect.yMax),
            new Vector2(aRect.xMax, aRect.yMin),
        };

        for (int i = 0; i < 4; i++)
        {
            var tRay = new Segment2D(cornerList[i], cornerList[(i + 1) % 4]);
            if (boundSegments.Any(x => tRay.getRightAngleOverlap(x).HasValue))
            {
                continue;
            }
            result.Add(tRay);
        }

        return(result);
    }