示例#1
0
        //Affine変換を変換した結果を返す
        public LDAffineTransform transform(LDAffineTransform affine, bool clip = false)
        {
            LDAffineTransform result = affine;

            //Cubismと違い位置しか移動しない
            result.setToTranslate(transform(affine.getTranslate(), clip));


            return(result);
        }
示例#2
0
        /*
         * public void serializeTest()
         * {
         *  string name = "gridMesh";
         *  LDGridTransform src = new LDGridTransform(0, 0, 100, 100, 2, 2));
         *
         *  //シリアライズ
         *  SerializeHelper.writeBoostXml(name, src);
         *
         *  //デシリアライズ
         *  var dst = SerializeHelper.readBoostXml<LDGridTransform>(name);
         *
         *  TestUtil.VERIFY(dst->getGridPoints() == src->getGridPoints());
         * }
         */
        public void simpleTransformTest()
        {
            LDGridTransform grid = new LDGridTransform(20, 20, 40, 40, 1, 1);

            {
                LDPoint src = new LDPoint(0.5f, 0.5f);

                LDPoint dst;

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.x(), 40.0);
                TestUtil.COMPARE(dst.y(), 40.0);
            }

            {
                LDPointList src = new LDPointList();
                src.add(new LDPoint(0.25f, 0.25f)).add(new LDPoint(0.75f, 0.75f));

                LDPointList dst;

                dst = grid.transform(src);

                TestUtil.VERIFY(dst.length() == 2);
                TestUtil.COMPARE(dst[0], new LDPoint(30.0f, 30));
                TestUtil.COMPARE(dst[1], new LDPoint(50.0f, 50));
            }

            {
                LDGridTransform src = new LDGridTransform(0.5f, 0.5f, 0.5f, 0.5f, 1, 1);

                LDGridTransform dst = new LDGridTransform();

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.getPoint(0, 0), new LDPoint(40, 40));
                TestUtil.COMPARE(dst.getPoint(0, 1), new LDPoint(60, 40));
                TestUtil.COMPARE(dst.getPoint(1, 1), new LDPoint(60, 60));
                TestUtil.COMPARE(dst.getPoint(1, 0), new LDPoint(40, 60));
            }

            {
                LDAffineTransform src = new LDAffineTransform();
                src.translate(0.5f, 0.5f);
                src.rotate(30);
                src.scale(2, 2);

                LDAffineTransform dst = new LDAffineTransform();

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.getTranslate(), new LDPoint(40, 40));
            }
        }
示例#3
0
        /*
        public void serializeTest()
        {
            string name = "gridMesh";
            LDGridTransform src = new LDGridTransform(0, 0, 100, 100, 2, 2));

            //シリアライズ
            SerializeHelper.writeBoostXml(name, src);

            //デシリアライズ
            var dst = SerializeHelper.readBoostXml<LDGridTransform>(name);

            TestUtil.VERIFY(dst->getGridPoints() == src->getGridPoints());
        }
        */
        public void simpleTransformTest()
        {
            LDGridTransform grid = new LDGridTransform(20, 20, 40, 40, 1, 1);

            {
                LDPoint src = new LDPoint(0.5f, 0.5f);

                LDPoint dst;

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.x(), 40.0);
                TestUtil.COMPARE(dst.y(), 40.0);
            }

            {
                LDPointList src = new LDPointList();
                src.add(new LDPoint(0.25f, 0.25f)).add(new LDPoint(0.75f, 0.75f));

                LDPointList dst;

                dst = grid.transform(src);

                TestUtil.VERIFY(dst.length() == 2);
                TestUtil.COMPARE(dst[0], new LDPoint(30.0f, 30));
                TestUtil.COMPARE(dst[1], new LDPoint(50.0f, 50));
            }

            {
                LDGridTransform src = new LDGridTransform(0.5f, 0.5f, 0.5f, 0.5f, 1, 1);

                LDGridTransform dst = new LDGridTransform();

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.getPoint(0, 0),new LDPoint(40, 40));
                TestUtil.COMPARE(dst.getPoint(0, 1),new LDPoint(60, 40));
                TestUtil.COMPARE(dst.getPoint(1, 1),new LDPoint(60, 60));
                TestUtil.COMPARE(dst.getPoint(1, 0),new LDPoint(40, 60));
            }

            {
                LDAffineTransform src = new LDAffineTransform();
                src.translate(0.5f, 0.5f);
                src.rotate(30);
                src.scale(2, 2);

                LDAffineTransform dst = new LDAffineTransform();

                dst = grid.transform(src);

                TestUtil.COMPARE(dst.getTranslate(), new LDPoint(40, 40));
            }
        }
示例#4
0
        //Affine変換を変換した結果を返す
        public LDAffineTransform transform(LDAffineTransform affine, bool clip = false)
        {
            LDAffineTransform result = affine;

            //Cubismと違い位置しか移動しない
            result.setToTranslate(transform(affine.getTranslate(), clip));

            return result;
        }