c#

Java code posted
created at 17 Dec 06:37

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
protected TDoubleRect GetBounds()
        {
            TLocalMinima lm = m_localMinimaList;
            if (lm == null) return new TDoubleRect(0, 0, 0, 0);

            TDoubleRect result = new TDoubleRect(-infinite, -infinite, infinite, infinite);
            while (lm != null)
            {
                if (lm.leftBound.y > result.bottom) result.bottom = lm.leftBound.y;
                TEdge e = lm.leftBound;
                while (e.nextInLML != null)
                {
                    if (e.x < result.left) result.left = e.x;
                    e = e.nextInLML;
                }
                if (e.x < result.left) result.left = e.x;
                else if (e.xtop < result.left) result.left = e.xtop;
                if (e.ytop < result.top) result.top = e.ytop;

                e = lm.rightBound;
                while (e.nextInLML != null)
                {
                    if (e.x > result.right) result.right = e.x;
                    e = e.nextInLML;
                }
                if (e.x > result.right) result.right = e.x;
                else if (e.xtop > result.right) result.right = e.xtop;

                lm = lm.nextLm;
            }
            return result;
        }
1.22 KB in 5 ms with coderay