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;
}
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;
}
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;
}
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();
}
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;
}
Aggregations