Package javax.vecmath

Examples of javax.vecmath.Vector4f


  }
 
  private static boolean notExist(Vector4f planeEquation, ObjectArrayList<Vector4f> planeEquations) {
    int numbrushes = planeEquations.size();
    for (int i = 0; i < numbrushes; i++) {
      Vector4f N1 = planeEquations.getQuick(i);
      if (VectorUtil.dot3(planeEquation, N1) > 0.999f) {
        return false;
      }
    }
    return true;
View Full Code Here


    }
    return true;
  }

  public static void getPlaneEquationsFromVertices(ObjectArrayList<Vector3f> vertices, ObjectArrayList<Vector4f> planeEquationsOut) {
    Vector4f planeEquation = Stack.alloc(Vector4f.class);
    Vector3f edge0 = Stack.alloc(Vector3f.class), edge1 = Stack.alloc(Vector3f.class);
    Vector3f tmp = Stack.alloc(Vector3f.class);

    int numvertices = vertices.size();
    // brute force:
    for (int i = 0; i < numvertices; i++) {
      Vector3f N1 = vertices.getQuick(i);

      for (int j = i + 1; j < numvertices; j++) {
        Vector3f N2 = vertices.getQuick(j);

        for (int k = j + 1; k < numvertices; k++) {
          Vector3f N3 = vertices.getQuick(k);

          edge0.sub(N2, N1);
          edge1.sub(N3, N1);
          float normalSign = 1f;
          for (int ww = 0; ww < 2; ww++) {
            tmp.cross(edge0, edge1);
            planeEquation.x = normalSign * tmp.x;
            planeEquation.y = normalSign * tmp.y;
            planeEquation.z = normalSign * tmp.z;

            if (VectorUtil.lengthSquared3(planeEquation) > 0.0001f) {
              VectorUtil.normalize3(planeEquation);
              if (notExist(planeEquation, planeEquationsOut)) {
                planeEquation.w = -VectorUtil.dot3(planeEquation, N1);

                // check if inside, and replace supportingVertexOut if needed
                if (areVerticesBehindPlane(planeEquation, vertices, 0.01f)) {
                  planeEquationsOut.add(new Vector4f(planeEquation));
                }
              }
            }
            normalSign = -1f;
          }
View Full Code Here

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

    int numbrushes = planeEquations.size();
    // brute force:
    for (int i = 0; i < numbrushes; i++) {
      Vector4f N1 = planeEquations.getQuick(i);

      for (int j = i + 1; j < numbrushes; j++) {
        Vector4f N2 = planeEquations.getQuick(j);

        for (int k = j + 1; k < numbrushes; k++) {
          Vector4f N3 = planeEquations.getQuick(k);

          VectorUtil.cross3(n2n3, N2, N3);
          VectorUtil.cross3(n3n1, N3, N1);
          VectorUtil.cross3(n1n2, N1, N2);
View Full Code Here

    return maxIndex;
  }

  public static int closestAxis4(Vector4f vec) {
    Vector4f tmp = new Vector4f(vec);
    tmp.absolute();
    return maxAxis4(tmp);
  }
View Full Code Here

/*     */
/* 626 */     TexCoordGenerationRetained tex = (TexCoordGenerationRetained)originalNodeComponent.retained;
/*     */
/* 628 */     TexCoordGenerationRetained rt = (TexCoordGenerationRetained)this.retained;
/*     */
/* 630 */     Vector4f v = new Vector4f();
/*     */
/* 632 */     rt.initGenMode(tex.getGenMode());
/* 633 */     tex.getPlaneS(v);
/* 634 */     rt.initPlaneS(v);
/* 635 */     tex.getPlaneT(v);
View Full Code Here

/*     */   }
/*     */
/*     */   final void setPlaneS(Vector4f planeS)
/*     */   {
/* 122 */     initPlaneS(planeS);
/* 123 */     sendMessage(2, new Vector4f(planeS));
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   final void setPlaneT(Vector4f planeT)
/*     */   {
/* 152 */     initPlaneT(planeT);
/* 153 */     sendMessage(4, new Vector4f(planeT));
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   final void setPlaneR(Vector4f planeR)
/*     */   {
/* 182 */     initPlaneR(planeR);
/* 183 */     sendMessage(8, new Vector4f(planeR));
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   final void setPlaneQ(Vector4f planeQ)
/*     */   {
/* 212 */     initPlaneQ(planeQ);
/* 213 */     sendMessage(16, new Vector4f(planeQ));
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   protected Object clone()
/*     */   {
/* 356 */     TexCoordGenerationRetained tr = (TexCoordGenerationRetained)super.clone();
/* 357 */     tr.planeS = new Vector4f(this.planeS);
/* 358 */     tr.planeT = new Vector4f(this.planeT);
/* 359 */     tr.planeR = new Vector4f(this.planeR);
/*     */
/* 361 */     return tr;
/*     */   }
View Full Code Here

TOP

Related Classes of javax.vecmath.Vector4f

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.