Package javax.vecmath

Examples of javax.vecmath.Vector3f.scale()


    if (cameraDistance > maxCameraDistance)
    {
      correctionFactor = 0.15f*(maxCameraDistance-cameraDistance)/cameraDistance;
    }
    Vector3f tmp = new Vector3f();
    tmp.scale(correctionFactor, camToObject);
    cameraPosition.sub(tmp);

    // update OpenGL camera settings
    gl.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10000.0);

View Full Code Here


    if (cameraDistance > maxCameraDistance)
    {
      correctionFactor = 0.15f*(maxCameraDistance-cameraDistance)/cameraDistance;
    }
    Vector3f tmp = new Vector3f();
    tmp.scale(correctionFactor, camToObject);
    cameraPosition.sub(tmp);

    // update OpenGL camera settings
    gl.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10000.0);

View Full Code Here

    float sum = oldNormalImpulse + normalImpulse;
    VectorUtil.setCoord(accumulatedImpulse, limit_index, sum > hi ? 0f : sum < lo ? 0f : sum);
    normalImpulse = VectorUtil.getCoord(accumulatedImpulse, limit_index) - oldNormalImpulse;

    Vector3f impulse_vector = Stack.alloc(Vector3f.class);
    impulse_vector.scale(normalImpulse, axis_normal_on_a);
    body1.applyImpulse(impulse_vector, rel_pos1);

    tmp.negate(impulse_vector);
    body2.applyImpulse(tmp, rel_pos2);
    return normalImpulse;
View Full Code Here

        }
      }

      appliedImpulse += impulse;
      Vector3f impulse_vector = Stack.alloc(Vector3f.class);
      impulse_vector.scale(impulse, normal);
      tmp.sub(pivotAInW, rbA.getCenterOfMassPosition(tmpVec));
      rbA.applyImpulse(impulse_vector, tmp);
      tmp.negate(impulse_vector);
      tmp2.sub(pivotBInW, rbB.getCenterOfMassPosition(tmpVec));
      rbB.applyImpulse(tmp, tmp2);
View Full Code Here

    Vector3f angVelA = rbA.getAngularVelocity(Stack.alloc(Vector3f.class));
    Vector3f angVelB = rbB.getAngularVelocity(Stack.alloc(Vector3f.class));

    Vector3f angVelAroundAxisA = Stack.alloc(Vector3f.class);
    angVelAroundAxisA.scale(axisA.dot(angVelA), axisA);
    Vector3f angVelAroundAxisB = Stack.alloc(Vector3f.class);
    angVelAroundAxisB.scale(axisB.dot(angVelB), axisB);

    Vector3f angAorthog = Stack.alloc(Vector3f.class);
    angAorthog.sub(angVelA, angVelAroundAxisA);
View Full Code Here

    Vector3f angVelB = rbB.getAngularVelocity(Stack.alloc(Vector3f.class));

    Vector3f angVelAroundAxisA = Stack.alloc(Vector3f.class);
    angVelAroundAxisA.scale(axisA.dot(angVelA), axisA);
    Vector3f angVelAroundAxisB = Stack.alloc(Vector3f.class);
    angVelAroundAxisB.scale(axisB.dot(angVelB), axisB);

    Vector3f angAorthog = Stack.alloc(Vector3f.class);
    angAorthog.sub(angVelA, angVelAroundAxisA);
    Vector3f angBorthog = Stack.alloc(Vector3f.class);
    angBorthog.sub(angVelB, angVelAroundAxisB);
View Full Code Here

    }

    // solve angular positional correction
    Vector3f angularError = Stack.alloc(Vector3f.class);
    angularError.cross(axisA, axisB);
    angularError.scale(1f / timeStep);
    float len2 = angularError.length();
    if (len2 > 0.00001f) {
      Vector3f normal2 = Stack.alloc(Vector3f.class);
      normal2.normalize(angularError);
      float denom2 = rbA.computeAngularImpulseDenominator(normal2) + rbB.computeAngularImpulseDenominator(normal2);
View Full Code Here

      tmp.sub(angVelB, angVelA);
      impulseMag = tmp.dot(axisA) * dampingDirAng + angDepth * restitutionDirAng / timeStep;
      impulseMag *= kAngle * softnessDirAng;
    }
    Vector3f impulse = Stack.alloc(Vector3f.class);
    impulse.scale(impulseMag, axisA);
    rbA.applyTorqueImpulse(impulse);
    tmp.negate(impulse);
    rbB.applyTorqueImpulse(tmp);

    // apply angular motor
View Full Code Here

        }
        accumulatedAngMotorImpulse = new_acc;

        // apply clamped impulse
        Vector3f motorImp = Stack.alloc(Vector3f.class);
        motorImp.scale(angImpulse, axisA);
        rbA.applyTorqueImpulse(motorImp);
        tmp.negate(motorImp);
        rbB.applyTorqueImpulse(tmp);
      }
    }
View Full Code Here

      normalImpulse = contactConstraint.appliedPushImpulse - oldNormalImpulse;

      Vector3f tmp = Stack.alloc(Vector3f.class);

      tmp.scale(body1.invMass, contactConstraint.contactNormal);
      body1.internalApplyPushImpulse(tmp, contactConstraint.angularComponentA, normalImpulse);

      tmp.scale(body2.invMass, contactConstraint.contactNormal);
      body2.internalApplyPushImpulse(tmp, contactConstraint.angularComponentB, -normalImpulse);
    }
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.