本文整理汇总了Java中javax.vecmath.Vector3f.absolute方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3f.absolute方法的具体用法?Java Vector3f.absolute怎么用?Java Vector3f.absolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Vector3f
的用法示例。
在下文中一共展示了Vector3f.absolute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appy_transform
import javax.vecmath.Vector3f; //导入方法依赖的package包/类
/**
* Apply a transform to an AABB.
*/
public void appy_transform(Transform trans) {
Vector3f tmp = Stack.alloc(Vector3f.class);
Vector3f center = Stack.alloc(Vector3f.class);
center.add(max, min);
center.scale(0.5f);
Vector3f extends_ = Stack.alloc(Vector3f.class);
extends_.sub(max, center);
// Compute new center
trans.transform(center);
Vector3f textends = Stack.alloc(Vector3f.class);
trans.basis.getRow(0, tmp);
tmp.absolute();
textends.x = extends_.dot(tmp);
trans.basis.getRow(1, tmp);
tmp.absolute();
textends.y = extends_.dot(tmp);
trans.basis.getRow(2, tmp);
tmp.absolute();
textends.z = extends_.dot(tmp);
min.sub(center, textends);
max.add(center, textends);
}
示例2: appy_transform_trans_cache
import javax.vecmath.Vector3f; //导入方法依赖的package包/类
/**
* Apply a transform to an AABB.
*/
public void appy_transform_trans_cache(BoxBoxTransformCache trans) {
Vector3f tmp = Stack.alloc(Vector3f.class);
Vector3f center = Stack.alloc(Vector3f.class);
center.add(max, min);
center.scale(0.5f);
Vector3f extends_ = Stack.alloc(Vector3f.class);
extends_.sub(max, center);
// Compute new center
trans.transform(center, center);
Vector3f textends = Stack.alloc(Vector3f.class);
trans.R1to0.getRow(0, tmp);
tmp.absolute();
textends.x = extends_.dot(tmp);
trans.R1to0.getRow(1, tmp);
tmp.absolute();
textends.y = extends_.dot(tmp);
trans.R1to0.getRow(2, tmp);
tmp.absolute();
textends.z = extends_.dot(tmp);
min.sub(center, textends);
max.add(center, textends);
}
示例3: projection_interval
import javax.vecmath.Vector3f; //导入方法依赖的package包/类
public void projection_interval(Vector3f direction, float[] vmin, float[] vmax) {
Vector3f tmp = Stack.alloc(Vector3f.class);
Vector3f center = Stack.alloc(Vector3f.class);
Vector3f extend = Stack.alloc(Vector3f.class);
get_center_extend(center, extend);
float _fOrigin = direction.dot(center);
tmp.absolute(direction);
float _fMaximumExtent = extend.dot(tmp);
vmin[0] = _fOrigin - _fMaximumExtent;
vmax[0] = _fOrigin + _fMaximumExtent;
}
示例4: collide_triangle_exact
import javax.vecmath.Vector3f; //导入方法依赖的package包/类
/**
* Test for a triangle, with edges.
*/
public boolean collide_triangle_exact(Vector3f p1, Vector3f p2, Vector3f p3, Vector4f triangle_plane) {
if (!collide_plane(triangle_plane)) {
return false;
}
Vector3f center = Stack.alloc(Vector3f.class), extends_ = Stack.alloc(Vector3f.class);
get_center_extend(center, extends_);
Vector3f v1 = Stack.alloc(Vector3f.class);
v1.sub(p1, center);
Vector3f v2 = Stack.alloc(Vector3f.class);
v2.sub(p2, center);
Vector3f v3 = Stack.alloc(Vector3f.class);
v3.sub(p3, center);
// First axis
Vector3f diff = Stack.alloc(Vector3f.class);
diff.sub(v2, v1);
Vector3f abs_diff = Stack.alloc(Vector3f.class);
abs_diff.absolute(diff);
// Test With X axis
TEST_CROSS_EDGE_BOX_X_AXIS_MCR(diff, abs_diff, v1, v3, extends_);
// Test With Y axis
TEST_CROSS_EDGE_BOX_Y_AXIS_MCR(diff, abs_diff, v1, v3, extends_);
// Test With Z axis
TEST_CROSS_EDGE_BOX_Z_AXIS_MCR(diff, abs_diff, v1, v3, extends_);
diff.sub(v3, v2);
abs_diff.absolute(diff);
// Test With X axis
TEST_CROSS_EDGE_BOX_X_AXIS_MCR(diff, abs_diff, v2, v1, extends_);
// Test With Y axis
TEST_CROSS_EDGE_BOX_Y_AXIS_MCR(diff, abs_diff, v2, v1, extends_);
// Test With Z axis
TEST_CROSS_EDGE_BOX_Z_AXIS_MCR(diff, abs_diff, v2, v1, extends_);
diff.sub(v1, v3);
abs_diff.absolute(diff);
// Test With X axis
TEST_CROSS_EDGE_BOX_X_AXIS_MCR(diff, abs_diff, v3, v2, extends_);
// Test With Y axis
TEST_CROSS_EDGE_BOX_Y_AXIS_MCR(diff, abs_diff, v3, v2, extends_);
// Test With Z axis
TEST_CROSS_EDGE_BOX_Z_AXIS_MCR(diff, abs_diff, v3, v2, extends_);
return true;
}