Package jinngine.math

Examples of jinngine.math.Vector3.dot()


    final Vector3 nJ3 = n.negate();
    final Vector3 nJ4 = r2.cross(n).negate();

    //First off, create the constraint in the normal direction
    final double e = cp.restitution; //coeficient of restitution
    final double uni = nJ1.dot(b1.state.velocity) + nJ2.dot(b1.state.omega) + nJ3.dot(b2.state.velocity) + nJ4.dot(b2.state.omega);
    final double unf = uni<0 ? -e*uni: 0;   
   
    //compute B vector
    final Matrix3 I1 = b1.state.inverseinertia;
    final Matrix3 M1 = b1.state.inverseanisotropicmass;
View Full Code Here


    if ( x.norm() > 1) {
      x.assign(x.normalize().multiply(1));
    }
   
    //relative velocities along spring
    double upax = (n.dot(upa));
    double upbx = (n.dot(upb));
   
    //Forces
    Vector3 Fspring = x.sub(n.multiply(equilibrium)).multiply(this.force); //spring force
    Vector3 Fdamper = n.multiply( (-upax+upbx) * this.damper  ); //damping force
View Full Code Here

      x.assign(x.normalize().multiply(1));
    }
   
    //relative velocities along spring
    double upax = (n.dot(upa));
    double upbx = (n.dot(upb));
   
    //Forces
    Vector3 Fspring = x.sub(n.multiply(equilibrium)).multiply(this.force); //spring force
    Vector3 Fdamper = n.multiply( (-upax+upbx) * this.damper  ); //damping force
    Vector3 Ftotal = Fspring.add( Fdamper );
View Full Code Here

    nj = b2.toModelNoTranslation(n);
       
    //Use a Gram-Schmidt process to create a orthonormal basis for the impact space
    Vector3 v1 = n.normalize(); Vector3 v2 = Vector3.i(); Vector3 v3 = Vector3.k();
    Vector3 t1 = v1.normalize();
    t2i = v2.sub( t1.multiply(t1.dot(v2)) );
   
    System.out.println(t2i);
   
    //in case v1 and v2 are parallel
    if ( t2i.isEpsilon(Vector3.e) ) {
View Full Code Here

    System.out.println(t2i);
   
    //in case v1 and v2 are parallel
    if ( t2i.isEpsilon(Vector3.e) ) {
      v2 = Vector3.j(); v3 = Vector3.k();
      t2i.assign(v2.sub( t1.multiply(t1.dot(v2)) ).normalize());
    } else {
      t2i.assign(t2i.normalize());
    }
   
    //tangent 2 in j body space
View Full Code Here

    //v1 parallel with v3
    if( v1.cross(v3).isEpsilon(Vector3.e) ) {
      v3 = Vector3.j();
    }
    //finally calculate t3
    t3i = v3.sub( t1.multiply(t1.dot(v3)).sub( t2i.multiply(t2i.dot(v3)) )).normalize();
   
   
    System.out.println(t3i);
   
    // create the controller
View Full Code Here

    // make sure product is excatly in [-1,1]
    product = Math.max( Math.min( product, 1), -1);   
    theta = -Math.acos( product )*sign;
   
    // angular velocity along axis
    this.velocity = axis.dot(b1.state.omega)-axis.dot(b2.state.omega);
    double bvalue = 0;
   
    // if limits are clamped together
    if ( Math.abs( lowerLimit - upperLimit) < shell && enableLimits) {
      correction = (theta - (upperLimit) )*(1/dt)*Kcor;
 
View Full Code Here

    // make sure product is excatly in [-1,1]
    product = Math.max( Math.min( product, 1), -1);   
    theta = -Math.acos( product )*sign;
   
    // angular velocity along axis
    this.velocity = axis.dot(b1.state.omega)-axis.dot(b2.state.omega);
    double bvalue = 0;
   
    // if limits are clamped together
    if ( Math.abs( lowerLimit - upperLimit) < shell && enableLimits) {
      correction = (theta - (upperLimit) )*(1/dt)*Kcor;
 
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.