use of javax.vecmath.Vector3f in project bdx by GoranM.
the class BoxShape method getVertex.
@Override
public void getVertex(int i, Vector3f vtx) {
Stack stack = Stack.enter();
Vector3f halfExtents = getHalfExtentsWithoutMargin(stack.allocVector3f());
vtx.set(halfExtents.x * (1 - (i & 1)) - halfExtents.x * (i & 1), halfExtents.y * (1 - ((i & 2) >> 1)) - halfExtents.y * ((i & 2) >> 1), halfExtents.z * (1 - ((i & 4) >> 2)) - halfExtents.z * ((i & 4) >> 2));
stack.leave();
}
use of javax.vecmath.Vector3f in project bdx by GoranM.
the class BoxShape method setMargin.
@Override
public void setMargin(float margin) {
Stack stack = Stack.enter();
// correct the implicitShapeDimensions for the margin
Vector3f oldMargin = stack.allocVector3f();
oldMargin.set(getMargin(), getMargin(), getMargin());
Vector3f implicitShapeDimensionsWithMargin = stack.allocVector3f();
implicitShapeDimensionsWithMargin.add(implicitShapeDimensions, oldMargin);
super.setMargin(margin);
Vector3f newMargin = stack.allocVector3f();
newMargin.set(getMargin(), getMargin(), getMargin());
implicitShapeDimensions.sub(implicitShapeDimensionsWithMargin, newMargin);
stack.leave();
}
use of javax.vecmath.Vector3f in project bdx by GoranM.
the class BoxShape method setLocalScaling.
@Override
public void setLocalScaling(Vector3f scaling) {
Stack stack = Stack.enter();
Vector3f oldMargin = stack.allocVector3f();
oldMargin.set(getMargin(), getMargin(), getMargin());
Vector3f implicitShapeDimensionsWithMargin = stack.allocVector3f();
implicitShapeDimensionsWithMargin.add(implicitShapeDimensions, oldMargin);
Vector3f unScaledImplicitShapeDimensionsWithMargin = stack.allocVector3f();
VectorUtil.div(unScaledImplicitShapeDimensionsWithMargin, implicitShapeDimensionsWithMargin, localScaling);
super.setLocalScaling(scaling);
VectorUtil.mul(implicitShapeDimensions, unScaledImplicitShapeDimensionsWithMargin, localScaling);
implicitShapeDimensions.sub(oldMargin);
stack.leave();
}
use of javax.vecmath.Vector3f in project bdx by GoranM.
the class BoxShape method getHalfExtentsWithMargin.
public Vector3f getHalfExtentsWithMargin(Vector3f out) {
Stack stack = Stack.enter();
Vector3f halfExtents = getHalfExtentsWithoutMargin(out);
Vector3f margin = stack.allocVector3f();
margin.set(getMargin(), getMargin(), getMargin());
halfExtents.add(margin);
stack.leave();
return out;
}
use of javax.vecmath.Vector3f in project bdx by GoranM.
the class BoxShape method getPlaneEquation.
public void getPlaneEquation(Vector4f plane, int i) {
Stack stack = Stack.enter();
Vector3f halfExtents = getHalfExtentsWithoutMargin(stack.allocVector3f());
switch(i) {
case 0:
plane.set(1f, 0f, 0f, -halfExtents.x);
break;
case 1:
plane.set(-1f, 0f, 0f, -halfExtents.x);
break;
case 2:
plane.set(0f, 1f, 0f, -halfExtents.y);
break;
case 3:
plane.set(0f, -1f, 0f, -halfExtents.y);
break;
case 4:
plane.set(0f, 0f, 1f, -halfExtents.z);
break;
case 5:
plane.set(0f, 0f, -1f, -halfExtents.z);
break;
default:
assert (false);
}
stack.leave();
}
Aggregations