Package com.bramosystems.oss.player.core.client.geom

Examples of com.bramosystems.oss.player.core.client.geom.TransformationMatrix


    @Test
    public void testTranslate() {
        System.out.println("translate");
        double x = 2.0;
        double y = 2.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.translate(x, y);

        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVx().setZ(x);
        instance2.getMatrix().getVy().setZ(y);

        assertEquals(instance, instance2);
    }
View Full Code Here


    @Test
    public void testScale() {
        System.out.println("scale");
        double x = 4.0;
        double y = 4.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.scale(x, y);

        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVx().setX(x);
        instance2.getMatrix().getVy().setY(y);

        assertEquals(instance, instance2);
    }
View Full Code Here

    @Test
    public void testRotate() {
        System.out.println("rotate");
        double angle = 6.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.rotate(angle);

        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVx().setX(cos);
        instance2.getMatrix().getVy().setX(sin);
        instance2.getMatrix().getVx().setY(-1 * sin);
        instance2.getMatrix().getVy().setY(cos);
        assertEquals(instance, instance2);
    }
View Full Code Here

    @Test
    public void testSkew() {
        System.out.println("skew");
        double ax = 2.0;
        double ay = 3.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.skew(ax, ay);

        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVy().setX(Math.tan(ay));
        instance2.getMatrix().getVx().setY(Math.tan(ax));
        assertEquals(instance, instance2);
    }
View Full Code Here

    @Test
    public void testScaleAndTranslate() {
        System.out.println("scaleAndTranslate");
        double x = 2.0;
        double y = 3.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.scale(x, y);
        instance.translate(x, y);

        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVx().setZ(x);
        instance2.getMatrix().getVy().setZ(y);
        instance2.getMatrix().getVx().setX(x);
        instance2.getMatrix().getVy().setY(y);

        assertEquals(instance2, instance);
    }
View Full Code Here

    @Test
    public void testTranslateAndScale() {
        System.out.println("translateAndScale");
        double x = 2.0;
        double y = 3.0;
        TransformationMatrix instance = new TransformationMatrix();
        instance.translate(x, y);
        instance.scale(x, y);

        TransformationMatrix instance2 = new TransformationMatrix();
        instance2.getMatrix().getVx().setZ(x);
        instance2.getMatrix().getVy().setZ(y);
        instance2.getMatrix().getVx().setX(x);
        instance2.getMatrix().getVy().setY(y);

        assertEquals(instance2, instance);
    }
View Full Code Here

    @Override
    public TransformationMatrix getMatrix() {
        checkAvailable();
        String[] elements = impl.getMatrix().split(",");

        TransformationMatrix matrix = new TransformationMatrix();
        matrix.getMatrix().getVx().setX(Double.parseDouble(elements[0]));
        matrix.getMatrix().getVy().setX(Double.parseDouble(elements[1]));
        matrix.getMatrix().getVx().setY(Double.parseDouble(elements[2]));
        matrix.getMatrix().getVy().setY(Double.parseDouble(elements[3]));
        matrix.getMatrix().getVx().setZ(Double.parseDouble(elements[4]));
        matrix.getMatrix().getVy().setZ(Double.parseDouble(elements[5]));
        return matrix;
    }
View Full Code Here

            });
        }

        private void doTransform(_Option option, double value) {
            if (player != null && player instanceof MatrixSupport) {
                TransformationMatrix matrix = ((MatrixSupport) player).getMatrix();

                switch (option) {
                    case Rotate:
                        matrix.rotate(Math.toRadians(value));
                        break;
                    case Scale:
                        matrix.scale(value, value);
                        break;
                    case Skew:
                        matrix.skew(Math.toRadians(value),
                                Math.toRadians(value));
                        break;
                    case Translate:
                        matrix.translate(value, value);
                }
                ((MatrixSupport) player).setMatrix(matrix);
            }
        }
View Full Code Here

TOP

Related Classes of com.bramosystems.oss.player.core.client.geom.TransformationMatrix

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.