Package jinngine.math

Examples of jinngine.math.Vector3


        new Matrix3().getColumnVectors(null, new Vector3(), new Vector3());
    }

    @Test(expected = NullPointerException.class)
    public void testColumnVectors03() {
        new Matrix3().getColumnVectors(new Vector3(), null, new Vector3());
    }
View Full Code Here


        new Matrix3().getColumnVectors(new Vector3(), null, new Vector3());
    }

    @Test(expected = NullPointerException.class)
    public void testColumnVectors04() {
        new Matrix3().getColumnVectors(new Vector3(), new Vector3(), null);
    }
View Full Code Here

        new Matrix3().getColumnVectors(new Vector3(), new Vector3(), null);
    }

    @Test
    public void testRowVectors() {
        final Vector3 r1 = new Vector3();
        final Vector3 r2 = new Vector3();
        final Vector3 r3 = new Vector3();
        new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.).getRowVectors(r1, r2, r3);
        assertEquals(1., r1.x);
View Full Code Here

        assertEquals(9., r3.z);
    }

    @Test(expected = NullPointerException.class)
    public void testRowVectors02() {
        new Matrix3().getRowVectors(null, new Vector3(), new Vector3());
    }
View Full Code Here

        new Matrix3().getRowVectors(null, new Vector3(), new Vector3());
    }

    @Test(expected = NullPointerException.class)
    public void testRowVectors03() {
        new Matrix3().getRowVectors(new Vector3(), null, new Vector3());
    }
View Full Code Here

        new Matrix3().getRowVectors(new Vector3(), null, new Vector3());
    }

    @Test(expected = NullPointerException.class)
    public void testRowVectors04() {
        new Matrix3().getRowVectors(new Vector3(), new Vector3(), null);
    }
View Full Code Here

    public void testScaleVector() {
        final Matrix3 m = new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final Vector3 s = new Vector3(2., 3., 4.);
        final Matrix3 r = m.scale(s);
        assertNotSame(r, m);
        //Vector unmodified
        assertEquals(2., s.x);
        assertEquals(3., s.y);
View Full Code Here

    @Test
    public void testMultiplyVector01() {
        final Matrix3 m = new Matrix3(1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final Vector3 v = new Vector3(10., 100., 1000.);
        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.,
View Full Code Here

      gb.getLocalTranslation(gbdisp);
     
      // apply body rotation to local displacements (centre of mass of objects)
      Matrix3.multiply(ga.getBody().state.rotation, gadisp, gadisp);
      Matrix3.multiply(gb.getBody().state.rotation, gbdisp, gbdisp);
      Vector3 direction = ga.getBody().getPosition().add(gadisp).sub(gb.getBody().getPosition().add(gbdisp));
     
      // if direction is too small select a default one
      if (direction.norm() < epsilon)
        direction.assign(0,1,0);

      // compute the largest possible starting lambda, based on
      // the support of A-B along the ray direction
      Vector3 sp = Sa.supportPoint(direction.negate()).sub(Sb.supportPoint(direction));
      double lambda = direction.dot(sp)/direction.dot(direction)-envelope/direction.norm();
      raycast.run(Sa, Sb, new Vector3(), direction, pa, pb, lambda, envelope, epsilon, false);
     
      // generate contact points
      generate(pa, pb, pa.sub(pb).normalize() );
     
      if (pa.isNaN() || pb.isNaN() ) {
View Full Code Here

   
    // reverse the points in face A, so they will be in counter-clock-wise order
    // when relating to the normal direction
    Collections.reverse(faceA);
   
    final Vector3 direction = v.normalize();
//    final Vector3 midpoint = a.add(b).multiply(0.5);
    final Vector3 midpoint = a.add(b).add(v.multiply(spb-spa)).multiply(0.5); // account for sphere sweeping
   
    // contact space basis
    final Matrix3 M = GramSchmidt.run(direction);

    // make sure the normal direction is in the z-component
    final Matrix3 B = new Matrix3(M.column(1),M.column(2),M.column(0));

    // since B is orthogonal its inverse equals its transpose
    final Matrix3 Binv = B.transpose();
   
    // create a result handler for the intersection algorithm
    final ORourke.ResultHandler handler = new ORourke.ResultHandler() {
      public final void intersection(final Vector3 p, final Vector3 q) {       
        final ContactPoint cp = new ContactPoint();

        cp.b1 = ga.getBody();
        cp.b2 = gb.getBody();
       
        cp.normal.assign(direction);
        cp.point.assign( B.multiply(new Vector3(p.x,p.y,0)).add(midpoint) );
       
        // distance along the z axis in contact space
        cp.distance = (p.z-q.z)-spb-spa;  // take into account sphere sweeping

        // if contact is within the envelope size
View Full Code Here

TOP

Related Classes of jinngine.math.Vector3

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.