Пример #1
0
        public LDPolygon getPolygon()
        {
            LDPolygon p = new LDPolygon();

            p.Add(m_topLeft);
            p.Add(m_topRight);
            p.Add(m_bottomRight);
            p.Add(m_bottomLeft);
            return(p);
        }
Пример #2
0
        public LDPolygon toPolygon(LDPointList points)
        {
            Debug.Assert((points.length() > m_index1));
            Debug.Assert(points.length() > m_index2);
            Debug.Assert(points.length() > m_index3);

            LDPolygon v = new LDPolygon();

            v.Add(new LDPoint(points.at(m_index1)));
            v.Add(new LDPoint(points.at(m_index2)));
            v.Add(new LDPoint(points.at(m_index3)));
            return(v);
        }
Пример #3
0
        public void getOutlinePolygonTest_simple()
        {
            LDTriangleList triangles = simpleTriangle();
            LDPointList    points    = new LDPointList();

            points.Add(new LDPoint(0, 0));
            points.Add(new LDPoint(0, 100));
            points.Add(new LDPoint(100, 100));

            LDPolygon compare = new LDPolygon();

            compare.Add(new LDPoint(0, 0));
            compare.Add(new LDPoint(0, 100));
            compare.Add(new LDPoint(100, 100));

            LDPolygon result = triangles.getOutlinePolygon(points);

            TestUtil.COMPARE(result, compare);
        }
Пример #4
0
        public LDPolygon translated(LDPoint offset)
        {
            LDPolygon translated = new LDPolygon();

            foreach (var p in this)
            {
                translated.Add(new LDPoint(p.x() + offset.x(), p.y() + offset.y()));
            }
            return(translated);
        }
Пример #5
0
        public LDPolygon getOutlinePolygon()
        {
            List <int> indices = getOutlinePointIndices();

            LDPolygon result = new LDPolygon();

            foreach (var index in indices)
            {
                result.Add(getPoint(index));
            }
            return(result);
        }
Пример #6
0
        public LDPolygon getOutlinePolygon(LDPointList points)
        {
            List <int> indices = getOutlinePointIndices(points);

            LDPolygon result = new LDPolygon();

            foreach (var index in indices)
            {
                common.LD_ASSERT_OUT_OF_INDEX(points, index);
                result.Add(points[index]);
            }
            return(result);
        }