Search in sources :

Example 6 with Vector3f

use of javax.vecmath.Vector3f in project bdx by GoranM.

the class Dbvt method update.

public boolean update(Node leaf, DbvtAabbMm volume, Vector3f velocity, float margin) {
    if (leaf.volume.Contain(volume)) {
        return false;
    }
    Stack stack = Stack.enter();
    Vector3f tmp = stack.allocVector3f();
    tmp.set(margin, margin, margin);
    volume.Expand(tmp);
    volume.SignedExpand(velocity);
    update(leaf, volume);
    stack.leave();
    return true;
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 7 with Vector3f

use of javax.vecmath.Vector3f in project bdx by GoranM.

the class DbvtAabbMm method ProjectMinimum.

public float ProjectMinimum(Vector3f v, int signs) {
    Vector3f[] b = new Vector3f[] { mx, mi };
    Stack stack = Stack.enter();
    Vector3f p = stack.allocVector3f();
    p.set(b[(signs >> 0) & 1].x, b[(signs >> 1) & 1].y, b[(signs >> 2) & 1].z);
    float result = p.dot(v);
    stack.leave();
    return result;
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 8 with Vector3f

use of javax.vecmath.Vector3f in project bdx by GoranM.

the class DbvtAabbMm method FromCR.

public static DbvtAabbMm FromCR(Vector3f c, float r, DbvtAabbMm out) {
    Stack stack = Stack.enter();
    Vector3f tmp = stack.allocVector3f();
    tmp.set(r, r, r);
    DbvtAabbMm result = FromCE(c, tmp, out);
    stack.leave();
    return result;
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 9 with Vector3f

use of javax.vecmath.Vector3f in project bdx by GoranM.

the class DbvtAabbMm method swap.

public static void swap(DbvtAabbMm p1, DbvtAabbMm p2) {
    Stack stack = Stack.enter();
    Vector3f tmp = stack.allocVector3f();
    tmp.set(p1.mi);
    p1.mi.set(p2.mi);
    p2.mi.set(tmp);
    tmp.set(p1.mx);
    p1.mx.set(p2.mx);
    p2.mx.set(tmp);
    stack.leave();
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 10 with Vector3f

use of javax.vecmath.Vector3f in project bdx by GoranM.

the class DbvtAabbMm method Intersect.

public static boolean Intersect(DbvtAabbMm a, DbvtAabbMm b, Transform xform) {
    Stack stack = Stack.enter();
    Vector3f d0 = stack.allocVector3f();
    Vector3f d1 = stack.allocVector3f();
    Vector3f tmp = stack.allocVector3f();
    // JAVA NOTE: check
    b.Center(d0);
    xform.transform(d0);
    d0.sub(a.Center(tmp));
    MatrixUtil.transposeTransform(d1, d0, xform.basis);
    float[] s0 = new float[] { 0, 0 };
    float[] s1 = new float[2];
    s1[0] = xform.origin.dot(d0);
    s1[1] = s1[0];
    a.AddSpan(d0, s0, 0, s0, 1);
    b.AddSpan(d1, s1, 0, s1, 1);
    if (s0[0] > (s1[1])) {
        stack.leave();
        return false;
    }
    if (s0[1] < (s1[0])) {
        stack.leave();
        return false;
    }
    stack.leave();
    return true;
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Aggregations

Vector3f (javax.vecmath.Vector3f)265 Stack (com.bulletphysics.util.Stack)197 Transform (com.bulletphysics.linearmath.Transform)53 Matrix3f (javax.vecmath.Matrix3f)25 ManifoldPoint (com.bulletphysics.collision.narrowphase.ManifoldPoint)14 StaticAlloc (com.bulletphysics.util.StaticAlloc)12 Matrix4f (javax.vecmath.Matrix4f)9 Vector4f (javax.vecmath.Vector4f)8 CollisionShape (com.bulletphysics.collision.shapes.CollisionShape)7 TypedConstraint (com.bulletphysics.dynamics.constraintsolver.TypedConstraint)7 CollisionObject (com.bulletphysics.collision.dispatch.CollisionObject)6 ObjectArrayList (com.bulletphysics.util.ObjectArrayList)5 ConvexShape (com.bulletphysics.collision.shapes.ConvexShape)4 SphereShape (com.bulletphysics.collision.shapes.SphereShape)4 RigidBody (com.bulletphysics.dynamics.RigidBody)4 HashMap (java.util.HashMap)4 Quat4f (javax.vecmath.Quat4f)4 VoronoiSimplexSolver (com.bulletphysics.collision.narrowphase.VoronoiSimplexSolver)3 CompoundShape (com.bulletphysics.collision.shapes.CompoundShape)3 ConcaveShape (com.bulletphysics.collision.shapes.ConcaveShape)3