Examples of Matrix4


Examples of jinngine.math.Matrix4

                    4260.0, 4840.0, 5420.0, 6000.0,}, r);
    }

    @Test(expected = NullPointerException.class)
    public void testAssignMultiply02() {
        new Matrix4().assignMultiply((Matrix4) null);
    }
View Full Code Here

Examples of jinngine.math.Matrix4

        new Matrix4().assignMultiply((Matrix4) null);
    }

    @Test
    public void testMultiplyVector01() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final Vector3 v = new Vector3(100., 10000., 1000000.);
        final Vector3 r = m.multiply(v);
        assertNotSame(r, v);//new Vector3 is returned
        //Input is not changed
        assertMatrixEquals(new double[]{
                    1., 2., 3., 4.,
                    5., 6., 7., 8.,
View Full Code Here

Examples of jinngine.math.Matrix4

    }

    @Test(expected = NullPointerException.class)
    public void testAssignMultiplyVector02() {
        new Matrix4().multiply((Vector3) null);
    }
View Full Code Here

Examples of jinngine.math.Matrix4

        new Matrix4().multiply((Vector3) null);
    }

    @Test
    public void testIsNan() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        assertFalse(m.isNaN());
        assertMatrixEquals(new double[]{
                    1., 2., 3., 4.,
                    5., 6., 7., 8.,
                    9., 10, 11, 12,
                    13, 14, 15, 16}, m);

        assertTrue(new Matrix4(
                1., Double.NaN, 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., Double.NaN, 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., Double.NaN,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                Double.NaN, 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., Double.NaN, 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., Double.NaN, 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., Double.NaN,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                Double.NaN, 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., Double.NaN, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, Double.NaN, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, Double.NaN,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                Double.NaN, 14, 15, 16).isNaN());

        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, Double.NaN, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, Double.NaN, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, Double.NaN).isNaN());
View Full Code Here

Examples of jmt.engine.graphic.Matrix4

    halfH = screenH / 2;
    aspect = screenW / screenH;
    prj.setScreenSize(size);
    prj.updateProjection();

    Matrix4 mv = prj.getModelView();
    eyeRT = Matrix4.createScale(0.95f * (enableCustomZoom ? zoomFactor
        : 1.0f));
    eyeRT.multSelf(Matrix4.createRotationX(rotX));
    eyeRT.multSelf(Matrix4.createRotationY(rotY));
    eyeRT.multSelf(Matrix4.createTranslation(-centroid.x(), centroid.y(),
        centroid.z()));
    Vector4 eyePos = Vector4.createPoint3D(0.0f, 0.0f, 10.0f);
    prj.lookAt(eyePos, Vector4.ORIGIN, false);
    prj.push(mv.clone());
    prj.push(eyeRT.clone());
    mv.set(eyeRT.mult(mv));

    originPrj = prj.project(Vector4.ORIGIN);
    axisPrjX = prj.project(nx);
    axisPrjY = prj.project(ny);
    axisPrjZ = prj.project(nz);
    axisLabelX = prj.project(lx);
    axisLabelY = prj.project(ly);
    axisLabelZ = prj.project(lz);
    eyeRT.set(prj.pop());

    eyeRT.multSelf(Matrix4.createScale((aspect < 1.0f ? aspect : 1.0f)
        / maxVertexDistance));
    mv.set(eyeRT.mult(prj.pop()));

    // TODO: Project points here instead of inside of paint()

    forward = mv.getRow(Matrix4.Z_INDEX);
    forward.normalize();
    splitByVisibility(forward);
  }
View Full Code Here

Examples of org.apache.sis.referencing.operation.matrix.Matrix4

     * and compares with our own matrix calculated using double arithmetic.
     */
    private static MatrixSIS getPositionVectorTransformation(final BursaWolfParameters p) {
        final double   S = 1 + p.dS / BursaWolfParameters.PPM;
        final double  RS = TO_RADIANS * S;
        final Matrix4 expected = new Matrix4(
                   S,  -p.rZ*RS,  +p.rY*RS,  p.tX,
            +p.rZ*RS,         S,  -p.rX*RS,  p.tY,
            -p.rY*RS,  +p.rX*RS,         S,  p.tZ,
                   0,         0,         01);

View Full Code Here

Examples of org.geotools.referencing.operation.matrix.Matrix4

            Matrix datumShift = DefaultGeodeticDatum.getAffineTransform(
                                    TemporaryDatum.unwrap(sourceDatum),
                                    TemporaryDatum.unwrap(targetDatum));
            if (datumShift == null) {
                if (lenientDatumShift) {
                    datumShift = new Matrix4(); // Identity transform.
                    identifier = ELLIPSOID_SHIFT;
                } else {
                    throw new OperationNotFoundException(Errors.format(
                                ErrorKeys.BURSA_WOLF_PARAMETERS_REQUIRED));
                }
            }
            final Matrix normalizeSource = swapAndScaleAxis(sourceCS, STANDARD);
            final Matrix normalizeTarget = swapAndScaleAxis(STANDARD, targetCS);
            /*
             * Since all steps are matrix, we can multiply them into a single matrix operation.
             * Note: XMatrix.multiply(XMatrix) is equivalents to AffineTransform.concatenate(...):
             *       First transform by the supplied transform and then transform the result
             *       by the original transform.
             *
             * We compute: matrix = normalizeTarget * datumShift * normalizeSource
             */
            matrix = new Matrix4(normalizeTarget);
            matrix.multiply(datumShift);
            matrix.multiply(normalizeSource);
        } catch (SingularMatrixException cause) {
            throw new OperationNotFoundException(getErrorMessage(sourceDatum, targetDatum), cause);
        }
View Full Code Here

Examples of org.sunflow.math.Matrix4

        break;
    }
   
    // Update camera location
    Point3 eye = new Point3(camera.getX(), camera.getZ(), camera.getY());
    Matrix4 transform;
    float yaw = camera.getYaw();
    float pitch;
    if (camera.getLens() == Camera.Lens.SPHERICAL) {
      pitch = 0;
    } else {
      pitch = camera.getPitch();
    }
    double pitchCos = Math.cos(pitch);
    if (Math.abs(pitchCos) > 1E-6) {
      // Set the point the camera is pointed to
      Point3 target = new Point3(
          camera.getX() - (float)(Math.sin(yaw) * pitchCos),
          camera.getZ() - (float)Math.sin(pitch),
          camera.getY() + (float)(Math.cos(yaw) * pitchCos));
      Vector3 up = new Vector3(0, 1, 0);             
      transform = Matrix4.lookAt(eye, target, up);
    } else {
      // Compute matrix directly when the camera points is at top
      transform = new Matrix4((float)-Math.cos(yaw), (float)-Math.sin(yaw), 0, camera.getX(),
          0, 0, 1, camera.getZ(),
          (float)-Math.sin(yaw), (float)Math.cos(yaw), 0, camera.getY());
    }
    this.sunflow.parameter("transform", transform);
    this.sunflow.parameter("fov", (float)Math.toDegrees(camera.getFieldOfView()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.