Exemple #1
0
        public void scale(ld_float scaleX, ld_float scaleY)
        {
            float tx = m_matrix.tx;
            float ty = m_matrix.ty;

            m_matrix.setToTranslate(-tx, -ty, 0);
            m_matrix.scale(scaleX, scaleY, 1);
            m_matrix.setToTranslate(tx, ty, 0);
        }
Exemple #2
0
        public void scaleTest()
        {
            LDMatrix44 expected = new LDMatrix44();
            LDMatrix44 actual = new LDMatrix44();
            //ld_float delta = 0.00001f;

            // Input : actual = 単位行列, x = 0.0, y = 0.0, z = 0.0 (ゼロ)
            expected.m11 = 0.0f;
            expected.m12 = 0.0f;
            expected.m13 = 0.0f;
            expected.m21 = 0.0f;
            expected.m22 = 0.0f;
            expected.m23 = 0.0f;
            expected.m31 = 0.0f;
            expected.m32 = 0.0f;
            expected.m33 = 0.0f;
            expected.m41 = 0.0f;
            expected.m42 = 0.0f;
            expected.m43 = 0.0f;
            actual.scale(0.0f, 0.0f, 0.0f);
            TestUtil.COMPARE(expected.m11, actual.m11);
            TestUtil.COMPARE(expected.m12, actual.m12);
            TestUtil.COMPARE(expected.m13, actual.m13);
            TestUtil.COMPARE(expected.m21, actual.m21);
            TestUtil.COMPARE(expected.m22, actual.m22);
            TestUtil.COMPARE(expected.m23, actual.m23);
            TestUtil.COMPARE(expected.m31, actual.m31);
            TestUtil.COMPARE(expected.m32, actual.m32);
            TestUtil.COMPARE(expected.m33, actual.m33);
            TestUtil.COMPARE(expected.m41, actual.m41);
            TestUtil.COMPARE(expected.m42, actual.m42);
            TestUtil.COMPARE(expected.m43, actual.m43);

            // Input : actual = 任意の値, x = 1.0, y = 2.0, z = 3.0 (任意の値)
            ld_float x = 1.0f;
            ld_float y = 2.0f;
            ld_float z = 3.0f;
            actual.m11 = 1.0f;
            actual.m12 = 2.0f;
            actual.m13 = 3.0f;
            actual.m21 = 1.0f;
            actual.m22 = 2.0f;
            actual.m23 = 3.0f;
            actual.m31 = 1.0f;
            actual.m32 = 2.0f;
            actual.m33 = 3.0f;
            actual.m41 = 1.0f;
            actual.m42 = 2.0f;
            actual.m43 = 3.0f;
            expected.m11 = actual.m11 * x;
            expected.m12 = actual.m12 * y;
            expected.m13 = actual.m13 * z;
            expected.m21 = actual.m21 * x;
            expected.m22 = actual.m22 * y;
            expected.m23 = actual.m23 * z;
            expected.m31 = actual.m31 * x;
            expected.m32 = actual.m32 * y;
            expected.m33 = actual.m33 * z;
            expected.m41 = actual.m41 * x;
            expected.m42 = actual.m42 * y;
            expected.m43 = actual.m43 * z;
            actual.scale(x, y, z);
            TestUtil.COMPARE(expected.m11, actual.m11);
            TestUtil.COMPARE(expected.m12, actual.m12);
            TestUtil.COMPARE(expected.m13, actual.m13);
            TestUtil.COMPARE(expected.m21, actual.m21);
            TestUtil.COMPARE(expected.m22, actual.m22);
            TestUtil.COMPARE(expected.m23, actual.m23);
            TestUtil.COMPARE(expected.m31, actual.m31);
            TestUtil.COMPARE(expected.m32, actual.m32);
            TestUtil.COMPARE(expected.m33, actual.m33);
            TestUtil.COMPARE(expected.m41, actual.m41);
            TestUtil.COMPARE(expected.m42, actual.m42);
            TestUtil.COMPARE(expected.m43, actual.m43);
        }
Exemple #3
0
        public void scaleTest()
        {
            LDMatrix44 expected = new LDMatrix44();
            LDMatrix44 actual   = new LDMatrix44();

            //ld_float delta = 0.00001f;

            // Input : actual = 単位行列, x = 0.0, y = 0.0, z = 0.0 (ゼロ)
            expected.m11 = 0.0f;
            expected.m12 = 0.0f;
            expected.m13 = 0.0f;
            expected.m21 = 0.0f;
            expected.m22 = 0.0f;
            expected.m23 = 0.0f;
            expected.m31 = 0.0f;
            expected.m32 = 0.0f;
            expected.m33 = 0.0f;
            expected.m41 = 0.0f;
            expected.m42 = 0.0f;
            expected.m43 = 0.0f;
            actual.scale(0.0f, 0.0f, 0.0f);
            TestUtil.COMPARE(expected.m11, actual.m11);
            TestUtil.COMPARE(expected.m12, actual.m12);
            TestUtil.COMPARE(expected.m13, actual.m13);
            TestUtil.COMPARE(expected.m21, actual.m21);
            TestUtil.COMPARE(expected.m22, actual.m22);
            TestUtil.COMPARE(expected.m23, actual.m23);
            TestUtil.COMPARE(expected.m31, actual.m31);
            TestUtil.COMPARE(expected.m32, actual.m32);
            TestUtil.COMPARE(expected.m33, actual.m33);
            TestUtil.COMPARE(expected.m41, actual.m41);
            TestUtil.COMPARE(expected.m42, actual.m42);
            TestUtil.COMPARE(expected.m43, actual.m43);

            // Input : actual = 任意の値, x = 1.0, y = 2.0, z = 3.0 (任意の値)
            ld_float x = 1.0f;
            ld_float y = 2.0f;
            ld_float z = 3.0f;

            actual.m11   = 1.0f;
            actual.m12   = 2.0f;
            actual.m13   = 3.0f;
            actual.m21   = 1.0f;
            actual.m22   = 2.0f;
            actual.m23   = 3.0f;
            actual.m31   = 1.0f;
            actual.m32   = 2.0f;
            actual.m33   = 3.0f;
            actual.m41   = 1.0f;
            actual.m42   = 2.0f;
            actual.m43   = 3.0f;
            expected.m11 = actual.m11 * x;
            expected.m12 = actual.m12 * y;
            expected.m13 = actual.m13 * z;
            expected.m21 = actual.m21 * x;
            expected.m22 = actual.m22 * y;
            expected.m23 = actual.m23 * z;
            expected.m31 = actual.m31 * x;
            expected.m32 = actual.m32 * y;
            expected.m33 = actual.m33 * z;
            expected.m41 = actual.m41 * x;
            expected.m42 = actual.m42 * y;
            expected.m43 = actual.m43 * z;
            actual.scale(x, y, z);
            TestUtil.COMPARE(expected.m11, actual.m11);
            TestUtil.COMPARE(expected.m12, actual.m12);
            TestUtil.COMPARE(expected.m13, actual.m13);
            TestUtil.COMPARE(expected.m21, actual.m21);
            TestUtil.COMPARE(expected.m22, actual.m22);
            TestUtil.COMPARE(expected.m23, actual.m23);
            TestUtil.COMPARE(expected.m31, actual.m31);
            TestUtil.COMPARE(expected.m32, actual.m32);
            TestUtil.COMPARE(expected.m33, actual.m33);
            TestUtil.COMPARE(expected.m41, actual.m41);
            TestUtil.COMPARE(expected.m42, actual.m42);
            TestUtil.COMPARE(expected.m43, actual.m43);
        }