Package jinngine.math

Examples of jinngine.math.Vector3.assign()


      state.iterations++;   
//        System.out.println("gjk iteration" + " " + v.norm()+ "  : " + state.simplexSize);
     
      // store points of convex objects a and b, and A-B
      sa.assign( Sa.supportPoint(state.v.negate()));
      sb.assign( Sb.supportPoint(state.v));                   
      w.assign( sa.sub(sb) );

      // termination condition
      // ||v||2 -v.w is an upper bound for ||vk-v(A-B)||2 which converges towards zero as k goes large
      if Math.abs(v.dot(v)-v.dot(w)) < epsilon*epsilon  || state.iterations>maxiter || state.simplexSize > 3 )
View Full Code Here


      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();
View Full Code Here

      public final void supportFeature(Vector3 d, List<Vector3> face) {}
      public final double sphereSweepRadius() {return 0;}
    };
   
        // perform intersection test on each corner point
    point.assign(xmax,ymax,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymax,zmax);
View Full Code Here

    point.assign(xmax,ymax,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymax,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymin,zmax);
View Full Code Here

    point.assign(xmin,ymax,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymin,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymin,zmax);
View Full Code Here

    point.assign(xmax,ymin,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymin,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymax,zmin);
View Full Code Here

    point.assign(xmin,ymin,zmax);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymax,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymax,zmin);
View Full Code Here

    point.assign(xmax,ymax,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymax,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymin,zmin);
View Full Code Here

    point.assign(xmin,ymax,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmax,ymin,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymin,zmin);
View Full Code Here

    point.assign(xmax,ymin,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    point.assign(xmin,ymin,zmin);
    gjk.run(Sa,Sb,pa,pb,0.0,1e-7,32);
    if (!gjk.getState().intersection)
      return false;

    // if here, all tests passed and the box is included in the Sa shape
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.