Examples of Vector4f


Examples of javax.vecmath.Vector4f

   
    return needsClip;
  }

  private void clipEdge(int v1, int v2) {
    Vector4f vtx1 = vertices[v1];
    Vector4f vtx2 = vertices[v2];
   
    Color3f c1 = colors[v1];
    Color3f c2 = colors[v2];
   
    float minZ = 0f;
View Full Code Here

Examples of javax.vecmath.Vector4f

  }

  @Override
  public void getPlane(Vector3f planeNormal, Vector3f planeSupport, int i) {
    // this plane might not be aligned...
    Vector4f plane = Stack.alloc(Vector4f.class);
    getPlaneEquation(plane, i);
    planeNormal.set(plane.x, plane.y, plane.z);
    Vector3f tmp = Stack.alloc(Vector3f.class);
    tmp.negate(planeNormal);
    localGetSupportingVertex(tmp, planeSupport);
View Full Code Here

Examples of javax.vecmath.Vector4f

public class GeometryUtil {

  public static boolean isPointInsidePlanes(ObjectArrayList<Vector4f> planeEquations, Vector3f point, float margin) {
    int numbrushes = planeEquations.size();
    for (int i = 0; i < numbrushes; i++) {
      Vector4f N1 = planeEquations.getQuick(i);
      float dist = VectorUtil.dot3(N1, point) + N1.w - margin;
      if (dist > 0f) {
        return false;
      }
    }
View Full Code Here

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

Examples of javax.vecmath.Vector4f

    }
    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

Examples of javax.vecmath.Vector4f

    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

Examples of javax.vecmath.Vector4f

    return maxIndex;
  }

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

Examples of javax.vecmath.Vector4f

/*     */
/* 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

Examples of javax.vecmath.Vector4f

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

Examples of javax.vecmath.Vector4f

/*     */   }
/*     */
/*     */   final void setPlaneT(Vector4f planeT)
/*     */   {
/* 152 */     initPlaneT(planeT);
/* 153 */     sendMessage(4, new Vector4f(planeT));
/*     */   }
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.