Package javax.vecmath

Examples of javax.vecmath.Vector3f.cross()


    }
    assert (!(p0 == p1 || p0 == p2 || p0 == p3 || p1 == p2 || p1 == p3 || p2 == p3));

    tmp1.sub(verts.getQuick(p1), verts.getQuick(p0));
    tmp2.sub(verts.getQuick(p2), verts.getQuick(p0));
    tmp2.cross(tmp1, tmp2);
    tmp1.sub(verts.getQuick(p3), verts.getQuick(p0));
    if (tmp1.dot(tmp2) < 0) {
      int swap_tmp = p2;
      p2 = p3;
      p3 = swap_tmp;
View Full Code Here


  }
 
  private static Vector3f orth(Vector3f v, Vector3f out) {
    Vector3f a = Stack.alloc(Vector3f.class);
    a.set(0f, 0f, 1f);
    a.cross(v, a);

    Vector3f b = Stack.alloc(Vector3f.class);
    b.set(0f, 1f, 0f);
    b.cross(v, b);
View Full Code Here

    a.set(0f, 0f, 1f);
    a.cross(v, a);

    Vector3f b = Stack.alloc(Vector3f.class);
    b.set(0f, 1f, 0f);
    b.cross(v, b);

    if (a.length() > b.length()) {
      out.normalize(a);
      return out;
    }
View Full Code Here

      m = maxdirfiltered(p, count, dir, allow);
      if (allow.get(m) == 3) {
        return m;
      }
      orth(dir, u);
      v.cross(u, dir);
      int ma = -1;
      for (float x = 0f; x <= 360f; x += 45f) {
        float s = (float) Math.sin(BulletGlobals.SIMD_RADS_PER_DEG * (x));
        float c = (float) Math.cos(BulletGlobals.SIMD_RADS_PER_DEG * (x));

 
View Full Code Here

    // return the normal of the triangle
    // inscribed by v0, v1, and v2
    tmp1.sub(v1, v0);
    tmp2.sub(v2, v1);
    Vector3f cp = Stack.alloc(Vector3f.class);
    cp.cross(tmp1, tmp2);
    float m = cp.length();
    if (m == 0) {
      out.set(1f, 0f, 0f);
      return out;
    }
View Full Code Here

  }
 
  // Game Programming Gems 2.10. make sure v0,v1 are normalized
  public static Quat4f shortestArcQuat(Vector3f v0, Vector3f v1, Quat4f out) {
    Vector3f c = Stack.alloc(Vector3f.class);
    c.cross(v0, v1);
    float d = v0.dot(v1);

    if (d < -1.0 + BulletGlobals.FLT_EPSILON) {
      // just pick any vector
      out.set(0.0f, 1.0f, 0.0f, 0.0f);
View Full Code Here

     Vector3f yunit = new Vector3f(0,1,0);
    
     Vector3f v = new Vector3f(p1.getX()-p0.getX(), p1.getY()-p0.getY(), p1.getZ()-p0.getZ());
    
     Vector3f cross = new Vector3f();
     cross.cross(yunit, v);
     // cross is the vector to rotate about
     float angle = yunit.angle(v);
    
     Transform3D rot = new Transform3D();
     rot.setRotation(new AxisAngle4f(cross.getX(),cross.getY(),cross.getZ(),angle));
View Full Code Here

/*     */
/*  86 */     Vector3f axis1 = new Vector3f();
/*  87 */     axis1.normalize(axis);
/*     */
/*  90 */     Vector3f normal = new Vector3f(0.0F, 1.0F, 0.0F);
/*  91 */     normal.cross(axis1, normal);
/*  92 */     if (normal.lengthSquared() < 0.5F) {
/*  93 */       normal.set(0.0F, 0.0F, 1.0F);
/*  94 */       normal.cross(axis1, normal);
/*     */     }
/*  96 */     normal.normalize();
View Full Code Here

/*     */
/*  90 */     Vector3f normal = new Vector3f(0.0F, 1.0F, 0.0F);
/*  91 */     normal.cross(axis1, normal);
/*  92 */     if (normal.lengthSquared() < 0.5F) {
/*  93 */       normal.set(0.0F, 0.0F, 1.0F);
/*  94 */       normal.cross(axis1, normal);
/*     */     }
/*  96 */     normal.normalize();
/*     */
/*  99 */     int divisions = 18;
/* 100 */     Point3f[] cap0 = new Point3f[divisions];
View Full Code Here

/* 180 */       for (int i = 0; i < 72; i += 3) {
/* 181 */         v0.sub(vertices[(i + 1)], vertices[i]);
/* 182 */         v1.sub(vertices[(i + 2)], vertices[i]);
/*     */
/* 184 */         Vector3f n = new Vector3f();
/* 185 */         n.cross(v0, v1);
/* 186 */         n.normalize();
/*     */
/* 188 */         normals[i] = n;
/* 189 */         normals[(i + 1)] = n;
/* 190 */         normals[(i + 2)] = n;
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.