Package javax.vecmath

Examples of javax.vecmath.Vector3f.sub()


    Vector3f aabbCenter = Stack.alloc(Vector3f.class);
    aabbCenter.add(aabbMax, aabbMin);
    aabbCenter.scale(0.5f);

    Vector3f scaledAabbHalfExtends = Stack.alloc(Vector3f.class);
    scaledAabbHalfExtends.sub(aabbMax, aabbMin);
    scaledAabbHalfExtends.scale(0.5f * uniformScalingFactor);

    aabbMin.sub(aabbCenter, scaledAabbHalfExtends);
    aabbMax.add(aabbCenter, scaledAabbHalfExtends);
  }
View Full Code Here


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

          Vector3f p = Stack.alloc(Vector3f.class);
          p.set(0f, 0f, 0f);
          Vector3f diff = Stack.alloc(Vector3f.class);
          diff.sub(p, from);

          Vector3f v = Stack.alloc(Vector3f.class);
          v.sub(to, from);

          float t = v.dot(diff);
View Full Code Here

          p.set(0f, 0f, 0f);
          Vector3f diff = Stack.alloc(Vector3f.class);
          diff.sub(p, from);

          Vector3f v = Stack.alloc(Vector3f.class);
          v.sub(to, from);

          float t = v.dot(diff);

          if (t > 0) {
            float dotVV = v.dot(v);
View Full Code Here

  public boolean closestPtPointTriangle(Vector3f p, Vector3f a, Vector3f b, Vector3f c, SubSimplexClosestResult result) {
    result.usedVertices.reset();

    // Check if P in vertex region outside A
    Vector3f ab = Stack.alloc(Vector3f.class);
    ab.sub(b, a);

    Vector3f ac = Stack.alloc(Vector3f.class);
    ac.sub(c, a);

    Vector3f ap = Stack.alloc(Vector3f.class);
View Full Code Here

    Vector3f ac = Stack.alloc(Vector3f.class);
    ac.sub(c, a);

    Vector3f ap = Stack.alloc(Vector3f.class);
    ap.sub(p, a);

    float d1 = ab.dot(ap);
    float d2 = ac.dot(ap);

    if (d1 <= 0f && d2 <= 0f)
View Full Code Here

      return true; // a; // barycentric coordinates (1,0,0)
    }

    // Check if P in vertex region outside B
    Vector3f bp = Stack.alloc(Vector3f.class);
    bp.sub(p, b);

    float d3 = ab.dot(bp);
    float d4 = ac.dot(bp);

    if (d3 >= 0f && d4 <= d3)
View Full Code Here

      //return a + v * ab; // barycentric coordinates (1-v,v,0)
    }

    // Check if P in vertex region outside C
    Vector3f cp = Stack.alloc(Vector3f.class);
    cp.sub(p, c);

    float d5 = ab.dot(cp);
    float d6 = ac.dot(cp);

    if (d6 >= 0f && d5 <= d6)
View Full Code Here

    float va = d3*d6 - d5*d4;
    if (va <= 0f && (d4 - d3) >= 0f && (d5 - d6) >= 0f) {
      float w = (d4 - d3) / ((d4 - d3) + (d5 - d6));

      Vector3f tmp = Stack.alloc(Vector3f.class);
      tmp.sub(c, b);
      result.closestPointOnSimplex.scaleAdd(w, tmp, b);

      result.usedVertices.usedVertexB = true;
      result.usedVertices.usedVertexC = true;
      result.setBarycentricCoordinates(0, 1f-w, w, 0f);
View Full Code Here

  public static int pointOutsideOfPlane(Vector3f p, Vector3f a, Vector3f b, Vector3f c, Vector3f d)
  {
    Vector3f tmp = Stack.alloc(Vector3f.class);

    Vector3f normal = Stack.alloc(Vector3f.class);
    normal.sub(b, a);
    tmp.sub(c, a);
    normal.cross(normal, tmp);

    tmp.sub(p, a);
    float signp = tmp.dot(normal); // [AP AB AC]
View Full Code Here

            Vector3f pt0 = vectorsPool.get();
            pt0.scaleAdd(vecLen, vec0, planeOrigin);

            Vector3f pt1 = vectorsPool.get();
            pt1.scale(vecLen, vec0);
            pt1.sub(planeOrigin, pt1);

            Vector3f pt2 = vectorsPool.get();
            pt2.scaleAdd(vecLen, vec1, planeOrigin);

            Vector3f pt3 = vectorsPool.get();
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.