Package javax.vecmath

Examples of javax.vecmath.Quat4f


    Vector3f axisInB = Stack.alloc(Vector3f.class);
    axisInB.negate(axisInA);
    centerOfMassA.basis.transform(axisInB);

    Quat4f rotationArc = QuaternionUtil.shortestArcQuat(axisInA, axisInB, Stack.alloc(Quat4f.class));
    Vector3f rbAxisB1 = QuaternionUtil.quatRotate(rotationArc, rbAxisA1, Stack.alloc(Vector3f.class));
    Vector3f rbAxisB2 = Stack.alloc(Vector3f.class);
    rbAxisB2.cross(axisInB, rbAxisB1);

    rbBFrame.origin.set(pivotInA);
View Full Code Here


    }
    else {
      // sync(fAngle) = sin(c*fAngle)/t
      axis.scale((float) Math.sin(0.5f * fAngle * timeStep) / fAngle, angvel);
    }
    Quat4f dorn = Stack.alloc(Quat4f.class);
    dorn.set(axis.x, axis.y, axis.z, (float) Math.cos(fAngle * timeStep * 0.5f));
    Quat4f orn0 = curTrans.getRotation(Stack.alloc(Quat4f.class));

    Quat4f predictedOrn = Stack.alloc(Quat4f.class);
    predictedOrn.mul(dorn, orn0);
    predictedOrn.normalize();
//  #endif
    predictedTransform.setRotation(predictedOrn);
  }
View Full Code Here

    MatrixUtil.invert(tmp);

    Matrix3f dmat = Stack.alloc(Matrix3f.class);
    dmat.mul(transform1.basis, tmp);

    Quat4f dorn = Stack.alloc(Quat4f.class);
    MatrixUtil.getRotation(dmat, dorn);
// #endif

    // floating point inaccuracy can lead to w component > 1..., which breaks

    dorn.normalize();

    angle[0] = QuaternionUtil.getAngle(dorn);
    axis.set(dorn.x, dorn.y, dorn.z);
    // TODO: probably not needed
    //axis[3] = btScalar(0.);
View Full Code Here

    float rw = -q.x * w.x - q.y * w.y - q.z * w.z;
    q.set(rx, ry, rz, rw);
  }
 
  public static Vector3f quatRotate(Quat4f rotation, Vector3f v, Vector3f out) {
    Quat4f q = Stack.alloc(rotation);
    QuaternionUtil.mul(q, v);

    Quat4f tmp = Stack.alloc(Quat4f.class);
    inverse(tmp, rotation);
    q.mul(tmp);
   
    out.set(q.x, q.y, q.z);
    return out;
View Full Code Here

/*     */
/*     */   private void setPathArrays(Quat4f[] quats, Point3f[] positions)
/*     */   {
/* 161 */     this.quats = new Quat4f[quats.length];
/* 162 */     for (int i = 0; i < quats.length; i++) {
/* 163 */       this.quats[i] = new Quat4f();
/* 164 */       this.quats[i].set(quats[i]);
/*     */     }
/*     */
/* 167 */     this.positions = new Point3f[positions.length];
/* 168 */     for (int i = 0; i < positions.length; i++) {
View Full Code Here

/*     */
/* 361 */     this.positions = new Point3f[len];
/* 362 */     this.quats = new Quat4f[len];
/*     */
/* 364 */     Point3f point = new Point3f();
/* 365 */     Quat4f quat = new Quat4f();
/*     */
/* 367 */     for (int i = 0; i < len; i++) {
/* 368 */       this.positions[i] = new Point3f();
/* 369 */       ri.getPosition(i, point);
/* 370 */       setPosition(i, point);
/*     */
/* 372 */       this.quats[i] = new Quat4f();
/* 373 */       ri.getQuat(i, quat);
/* 374 */       setQuat(i, quat);
/*     */     }
/*     */   }
View Full Code Here

/*     */   public TCBKeyFrame(float k, int l, Point3f pos, Quat4f q, Point3f s, float t, float c, float b)
/*     */   {
/*  98 */     this.knot = k;
/*  99 */     this.linear = l;
/* 100 */     this.position = new Point3f(pos);
/* 101 */     this.quat = new Quat4f(q);
/* 102 */     this.scale = new Point3f(s);
/*     */
/* 105 */     if ((t < -1.0F) || (t > 1.0F)) {
/* 106 */       throw new IllegalArgumentException(J3dUtilsI18N.getString("TCBKeyFrame0"));
/*     */     }
View Full Code Here

/*  67 */     this.positions = new Point3f[this.knots.length];
/*  68 */     this.quats = new Quat4f[this.knots.length];
/*  69 */     this.scales = new float[this.knots.length];
/*  70 */     for (int i = 0; i < this.positions.length; i++) {
/*  71 */       this.positions[i] = new Point3f();
/*  72 */       this.quats[i] = new Quat4f();
/*     */     }
/*     */
/*  75 */     ((RotPosScalePathInterpolator)this.node).getPositions(this.positions);
/*  76 */     ((RotPosScalePathInterpolator)this.node).getQuats(this.quats);
/*  77 */     ((RotPosScalePathInterpolator)this.node).getScales(this.scales);
View Full Code Here

/*     */   public void writeQuat4f(DataOutput out, Quat4f vec) throws IOException {
/* 758 */     writeTuple4f(out, vec);
/*     */   }
/*     */
/*     */   public Quat4f readQuat4f(DataInput in) throws IOException {
/* 762 */     return (Quat4f)readTuple4f(in, new Quat4f());
/*     */   }
View Full Code Here

/*     */
/*     */   private void setPathArrays(Quat4f[] quats, Point3f[] positions, float[] scales)
/*     */   {
/* 200 */     this.quats = new Quat4f[quats.length];
/* 201 */     for (int i = 0; i < quats.length; i++) {
/* 202 */       this.quats[i] = new Quat4f();
/* 203 */       this.quats[i].set(quats[i]);
/*     */     }
/*     */
/* 206 */     this.positions = new Point3f[positions.length];
/* 207 */     for (int i = 0; i < positions.length; i++) {
View Full Code Here

TOP

Related Classes of javax.vecmath.Quat4f

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.