Ejemplo n.º 1
0
        /*
         * public void serializeTest()
         * {
         *  const char* name = "lineList";
         *  QSharedPointer<LDIndexLineList> src(new LDIndexLineList);
         *  src->push_back(LDIndexLine(0, 1));
         *
         *  //シリアライズ
         *  SerializeHelper::writeBoostXml(name, src);
         *
         *  //デシリアライズ
         *  auto dst = SerializeHelper::readBoostXml<LDIndexLineList>(name);
         *
         *  QVERIFY(*(dst.data()) == *(src.data()));
         * }
         */

        public void hitTest()
        {
            LDIndexLineList lines  = new LDIndexLineList();
            LDIndexLine     line_1 = new LDIndexLine(0, 1);
            LDIndexLine     line_2 = new LDIndexLine(1, 2);
            LDIndexLine     line_3 = new LDIndexLine(2, 3);
            LDIndexLine     line_4 = new LDIndexLine(3, 0);

            lines.add(line_1);
            lines.add(line_2);
            lines.add(line_3);
            lines.add(line_4);

            LDPointList points = new LDPointList();

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


            TestUtil.COMPARE(lines.isHit(points, new LDPoint(0, 0), 1), true);    //頂点上
            TestUtil.COMPARE(lines.isHit(points, new LDPoint(50, 0), 1), true);   //線上
            TestUtil.COMPARE(lines.isHit(points, new LDPoint(50, 1), 3), true);   //線からちょっと離れたところ
            TestUtil.COMPARE(lines.isHit(points, new LDPoint(50, 4), 3), false);  //線から範囲外に離れたところ
            TestUtil.COMPARE(lines.isHit(points, new LDPoint(200, 0), 3), false); //線の延長戦上に離れたところ
            TestUtil.COMPARE(lines.isHit(points, new LDPoint(200, 1), 3), false); //線の延長戦上に離れたところ
        }
Ejemplo n.º 2
0
        public LDPointList getPointList()
        {
            LDPointList result = new LDPointList();

            result.Add(m_topLeft);
            result.Add(m_topRight);
            result.Add(m_bottomRight);
            result.Add(m_bottomLeft);

            return(result);
        }
Ejemplo n.º 3
0
        public void getOutlinePointsTest_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));

            LDPointList compare = points;

            LDPointList result = triangles.getOutlinePoints(points);

            TestUtil.COMPARE(result, compare);
        }
Ejemplo n.º 4
0
        public LDPointList inverseTransform(LDPointList pList, bool clip = false)
        {
            LDPointList result = new LDPointList();

            foreach (var pt in pList)
            {
                result.Add(inverseTransform(pt, clip));
            }
            return(result);
        }
Ejemplo n.º 5
0
        public LDPointList inverseTransform(LDPointList points)
        {
            LDPointList result = new LDPointList();

            foreach (var pt in points)
            {
                result.Add(inverseTransform(pt));
            }

            return(result);
        }
Ejemplo n.º 6
0
        public LDPointList transform(LDPointList form)
        {
            LDPointList result = new LDPointList();

            foreach (var pt in form)
            {
                result.Add(transform(pt));
            }

            return(result);
        }
Ejemplo n.º 7
0
        public void getOutlinePointIndicesTest_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));

            List <int> compare = new List <int>();

            compare.Add(0);
            compare.Add(1);
            compare.Add(2);

            List <int> result = triangles.getOutlinePointIndices(points);

            TestUtil.COMPARELIST(result, compare);
        }
Ejemplo n.º 8
0
        public LDPointList inverseTransform(LDPointList points, bool clip = false)
        {
            LDPointList result = new LDPointList();
            int         length = points.length();

            for (int i = 0; i < length; i++)
            {
                result.Add(inverseTransform(points[i], clip));
            }
            return(result);
        }
Ejemplo n.º 9
0
        public LDPointList getOutlinePoints()
        {
            List <int> indices = getOutlinePointIndices();

            LDPointList result = new LDPointList();

            foreach (var index in indices)
            {
                result.Add(getPoint(index));
            }
            return(result);
        }
Ejemplo n.º 10
0
        public LDPointList toForm()
        {
            LDPointList result = new LDPointList();

            for (int i = 0; i < getRow() + 1; ++i)
            {
                for (int j = 0; j < getColumn() + 1; ++j)
                {
                    result.Add(m_gridPoints[i][j]);
                }
            }
            return(result);
        }
Ejemplo n.º 11
0
        public LDPointList getOutlinePoints(LDPointList points)
        {
            List <int> indices = getOutlinePointIndices(points);

            LDPointList result = new LDPointList();

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