Package jinngine.math

Examples of jinngine.math.Vector3.multiply()


      //return new Vector3[] {y1,y2,y3,y4};
      if ( d1234_1 > 0 && d1234_2 > 0 && d1234_3 > 0 && d1234_4 > 0) {
        //GJK penetrating state

        //check for the accuracy, v should be the zero vector
        ify1.multiply(d1234_1/d1234).add(y2.multiply(d1234_2/d1234)).add(y3.multiply(d1234_3/d1234)).add(y4.multiply(d1234_4/d1234)).norm() > 1 ) {
          //System.out.println("wrong penetration");
          //result is bad, terminate with last good subset {y1,y2,y3}
          state.simplexSize = 3;
          return false;
        }
View Full Code Here


      // add two icos to vertices
      Iterator<Vector3> iter = icosphere.getVertices();
      while(iter.hasNext()) {
        Vector3 v = iter.next();
        vertices.add( v.multiply(cap.getRadius()).add(0,0,cap.getLength()/2));
        vertices.add( v.multiply(cap.getRadius()).add(0,0,-cap.getLength()/2));
      }
       
      final ConvexHull hull = new ConvexHull(vertices);
     
View Full Code Here

      // add two icos to vertices
      Iterator<Vector3> iter = icosphere.getVertices();
      while(iter.hasNext()) {
        Vector3 v = iter.next();
        vertices.add( v.multiply(cap.getRadius()).add(0,0,cap.getLength()/2));
        vertices.add( v.multiply(cap.getRadius()).add(0,0,-cap.getLength()/2));
      }
       
      final ConvexHull hull = new ConvexHull(vertices);
     
      toDraw.add( new DrawShape() {   
View Full Code Here

   
    int N = 1024*2;
    Vector3 displacement = new Vector3(-4,1,-2);
    for (int i=0; i<N; i++) {
      // displace geometry and find the expected distance
      b1.setPosition(displacement.multiply((double)i/N));
      double length = displacement.multiply((double)i/N).norm();
      double expected = length>2?length-2:0;

      //closest point vectors
      Vector3 p1 = new Vector3();
View Full Code Here

    int N = 1024*2;
    Vector3 displacement = new Vector3(-4,1,-2);
    for (int i=0; i<N; i++) {
      // displace geometry and find the expected distance
      b1.setPosition(displacement.multiply((double)i/N));
      double length = displacement.multiply((double)i/N).norm();
      double expected = length>2?length-2:0;

      //closest point vectors
      Vector3 p1 = new Vector3();
      Vector3 p2 = new Vector3();
View Full Code Here

          // add to final inertia matrix
          Matrix3.add(inertia, localinertia, inertia);

          // update centre of mass vector
          Vector3.add(centreofmass, localcentre.multiply(localmass));

          // done with this branch
          return;
        }
//      }
View Full Code Here

    // angular axis where relative velocity must be zero
    Vector3 q = n1iw.cross(n2jw);
   
    angular1.assign(
        bi,  bj,
        new Vector3(), bi.isFixed()? new Vector3() : bi.state.inverseinertia.multiply(q), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(q.multiply(-1)),
        new Vector3(), q, new Vector3(), q.multiply(-1),
        Double.NEGATIVE_INFINITY,
        Double.POSITIVE_INFINITY,
        null,
        q.dot(bi.state.omega)-q.dot(bj.state.omega) - Kcor*(-n1iw.dot(n2jw))*(1/dt), );   
View Full Code Here

    Vector3 q = n1iw.cross(n2jw);
   
    angular1.assign(
        bi,  bj,
        new Vector3(), bi.isFixed()? new Vector3() : bi.state.inverseinertia.multiply(q), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(q.multiply(-1)),
        new Vector3(), q, new Vector3(), q.multiply(-1),
        Double.NEGATIVE_INFINITY,
        Double.POSITIVE_INFINITY,
        null,
        q.dot(bi.state.omega)-q.dot(bj.state.omega) - Kcor*(-n1iw.dot(n2jw))*(1/dt), );   

View Full Code Here

      // if motor is working to leave the limit, we need an extra
      // velocity constraint to model the motors contribution at the limit
      if ( joint.motorTargetVelocity<0 && joint.motor>0) {
        joint.extra.assign(
            bi,  bj,
            new Vector3(), bi.isFixed()? new Vector3():bi.state.inverseinertia.multiply(axis), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(axis.multiply(-1)),
            new Vector3(), axis, new Vector3(), axis.multiply(-1),
            -joint.motor,
            0,
            null,
            joint.velocity-joint.motorTargetVelocity, 0 );
View Full Code Here

      // velocity constraint to model the motors contribution at the limit
      if ( joint.motorTargetVelocity<0 && joint.motor>0) {
        joint.extra.assign(
            bi,  bj,
            new Vector3(), bi.isFixed()? new Vector3():bi.state.inverseinertia.multiply(axis), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(axis.multiply(-1)),
            new Vector3(), axis, new Vector3(), axis.multiply(-1),
            -joint.motor,
            0,
            null,
            joint.velocity-joint.motorTargetVelocity, 0 );
        // add the motor constraint
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.