本文整理汇总了Java中com.bulletphysics.linearmath.MiscUtil类的典型用法代码示例。如果您正苦于以下问题:Java MiscUtil类的具体用法?Java MiscUtil怎么用?Java MiscUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MiscUtil类属于com.bulletphysics.linearmath包,在下文中一共展示了MiscUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: split
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private static void split (ObjectArrayList<Node> leaves, ObjectArrayList<Node> left, ObjectArrayList<Node> right, Vector3 org,
Vector3 axis) {
Stack stack = Stack.enter();
Vector3 tmp = stack.allocVector3();
MiscUtil.resize(left, 0, NEW_NODE_SUPPLIER);
MiscUtil.resize(right, 0, NEW_NODE_SUPPLIER);
for (int i = 0, ni = leaves.size(); i < ni; i++) {
leaves.getQuick(i).volume.Center(tmp);
tmp.sub(org);
if (axis.dot(tmp) < 0f) {
left.add(leaves.getQuick(i));
} else {
right.add(leaves.getQuick(i));
}
}
stack.leave();
}
示例2: sortIslands
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
/**
* This is a special operation, destroying the content of UnionFind.
* It sorts the elements, based on island id, in order to make it easy to iterate over islands.
*/
public void sortIslands() {
// first store the original body index, and islandId
int numElements = elements.size();
for (int i = 0; i < numElements; i++) {
elements.getQuick(i).id = find(i);
elements.getQuick(i).sz = i;
}
// Sort the vector using predicate and std::sort
//std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
//perhaps use radix sort?
//elements.heapSort(btUnionFindElementSortPredicate());
//Collections.sort(elements);
MiscUtil.quickSort(elements, elementComparator);
}
示例3: calchull
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private int calchull (ObjectArrayList<Vector3> verts, int verts_count, IntArray tris_out, int[] tris_count, int vlimit) {
int rc = calchullgen(verts, verts_count, vlimit);
if (rc == 0) return 0;
IntArray ts = new IntArray();
for (int i = 0; i < tris.size(); i++) {
if (tris.getQuick(i) != null) {
for (int j = 0; j < 3; j++) {
ts.add((tris.getQuick(i)).getCoord(j));
}
deAllocateTriangle(tris.getQuick(i));
}
}
tris_count[0] = ts.size / 3;
MiscUtil.resize(tris_out, ts.size, 0);
for (int i = 0; i < ts.size; i++) {
tris_out.set(i, ts.get(i));
}
MiscUtil.resize(tris, 0, NEW_TRI_SUPPLIER);
return 1;
}
示例4: calchull
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private int calchull(ObjectArrayList<Vector3f> verts, int verts_count, IntArrayList tris_out, int[] tris_count, int vlimit) {
int rc = calchullgen(verts, verts_count, vlimit);
if (rc == 0) return 0;
IntArrayList ts = new IntArrayList();
for (int i=0; i<tris.size(); i++) {
if (tris.getQuick(i) != null) {
for (int j = 0; j < 3; j++) {
ts.add((tris.getQuick(i)).getCoord(j));
}
deAllocateTriangle(tris.getQuick(i));
}
}
tris_count[0] = ts.size() / 3;
MiscUtil.resize(tris_out, ts.size(), 0);
for (int i=0; i<ts.size(); i++) {
tris_out.set(i, ts.get(i));
}
MiscUtil.resize(tris, 0, Tri.class);
return 1;
}
示例5: solveConstraints
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
protected void solveConstraints(ContactSolverInfo solverInfo) {
BulletStats.pushProfile("solveConstraints");
try {
// sorted version of all btTypedConstraint, based on islandId
sortedConstraints.clear();
for (int i=0; i<constraints.size(); i++) {
sortedConstraints.add(constraints.getQuick(i));
}
//Collections.sort(sortedConstraints, sortConstraintOnIslandPredicate);
MiscUtil.quickSort(sortedConstraints, sortConstraintOnIslandPredicate);
ObjectArrayList<TypedConstraint> constraintsPtr = getNumConstraints() != 0 ? sortedConstraints : null;
solverCallback.init(solverInfo, constraintSolver, constraintsPtr, sortedConstraints.size(), debugDrawer/*,m_stackAlloc*/, dispatcher1);
constraintSolver.prepareSolve(getCollisionWorld().getNumCollisionObjects(), getCollisionWorld().getDispatcher().getNumManifolds());
// solve all the constraints for this island
islandManager.buildAndProcessIslands(getCollisionWorld().getDispatcher(), getCollisionWorld().getCollisionObjectArray(), solverCallback);
constraintSolver.allSolved(solverInfo, debugDrawer/*, m_stackAlloc*/);
}
finally {
BulletStats.popProfile();
}
}
示例6: sortIslands
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
/**
* This is a special operation, destroying the content of UnionFind.
* It sorts the elements, based on island id, in order to make it easy to iterate over islands.
*/
public void sortIslands() {
// first store the original body index, and islandId
int numElements = elements.size();
for (int i = 0; i < numElements; i++) {
elements.get(i).id = find(i);
elements.get(i).sz = i;
}
// Sort the vector using predicate and std::sort
//std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
//perhaps use radix sort?
//elements.heapSort(btUnionFindElementSortPredicate());
//Collections.sort(elements);
MiscUtil.quickSort(elements, elementComparator);
}
示例7: calchull
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private int calchull(List<Vector3f> verts, int verts_count, IntArrayList tris_out, int[] tris_count, int vlimit) {
int rc = calchullgen(verts, verts_count, vlimit);
if (rc == 0) return 0;
IntArrayList ts = new IntArrayList();
for (int i=0; i<tris.size(); i++) {
if (tris.get(i) != null) {
for (int j = 0; j < 3; j++) {
ts.add((tris.get(i)).getCoord(j));
}
deAllocateTriangle(tris.get(i));
}
}
tris_count[0] = ts.size() / 3;
MiscUtil.resize(tris_out, ts.size(), 0);
for (int i=0; i<ts.size(); i++) {
tris_out.set(i, ts.get(i));
}
MiscUtil.resize(tris, 0, Tri.class);
return 1;
}
示例8: solveConstraints
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
protected void solveConstraints(ContactSolverInfo solverInfo) {
BulletStats.pushProfile("solveConstraints");
try {
// sorted version of all btTypedConstraint, based on islandId
sortedConstraints.clear();
for (int i=0; i<constraints.size(); i++) {
sortedConstraints.add(constraints.get(i));
}
//Collections.sort(sortedConstraints, sortConstraintOnIslandPredicate);
MiscUtil.quickSort(sortedConstraints, sortConstraintOnIslandPredicate);
List<TypedConstraint> constraintsPtr = getNumConstraints() != 0 ? sortedConstraints : null;
solverCallback.init(solverInfo, constraintSolver, constraintsPtr, sortedConstraints.size(), debugDrawer/*,m_stackAlloc*/, dispatcher1);
constraintSolver.prepareSolve(getCollisionWorld().getNumCollisionObjects(), getCollisionWorld().getDispatcher().getNumManifolds());
// solve all the constraints for this island
islandManager.buildAndProcessIslands(getCollisionWorld().getDispatcher(), getCollisionWorld().getCollisionObjectArray(), solverCallback);
constraintSolver.allSolved(solverInfo, debugDrawer/*, m_stackAlloc*/);
}
finally {
BulletStats.popProfile();
}
}
示例9: ShapeHull
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
public ShapeHull(ConvexShape shape) {
this.shape = shape;
this.vertices.clear();
this.indices.clear();
this.numIndices = 0;
MiscUtil.resize(unitSpherePoints, NUM_UNITSPHERE_POINTS+ConvexShape.MAX_PREFERRED_PENETRATION_DIRECTIONS*2, Suppliers.NEW_VECTOR3_SUPPLIER);
for (int i=0; i<constUnitSpherePoints.size(); i++) {
unitSpherePoints.getQuick(i).set(constUnitSpherePoints.getQuick(i));
}
}
示例10: growTables
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private void growTables() {
int newCapacity = overlappingPairArray.capacity();
if (hashTable.size < newCapacity) {
// grow hashtable and next table
int curHashtableSize = hashTable.size;
MiscUtil.resize(hashTable, newCapacity, 0);
MiscUtil.resize(next, newCapacity, 0);
for (int i=0; i<newCapacity; ++i) {
hashTable.set(i, NULL_PAIR);
}
for (int i=0; i<newCapacity; ++i) {
next.set(i, NULL_PAIR);
}
for (int i=0; i<curHashtableSize; i++) {
BroadphasePair pair = overlappingPairArray.getQuick(i);
int proxyId1 = pair.pProxy0.getUid();
int proxyId2 = pair.pProxy1.getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hashValue = getHash(proxyId1, proxyId2) & (overlappingPairArray.capacity() - 1); // New hash value with new mask
next.set(i, hashTable.get(hashValue));
hashTable.set(hashValue, i);
}
}
}
示例11: solveConstraints
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
protected void solveConstraints (ContactSolverInfo solverInfo) {
BulletStats.pushProfile("solveConstraints");
try {
// sorted version of all btTypedConstraint, based on islandId
sortedConstraints.clear();
for (int i = 0; i < constraints.size(); i++) {
sortedConstraints.add(constraints.getQuick(i));
}
// Collections.sort(sortedConstraints, sortConstraintOnIslandPredicate);
MiscUtil.quickSort(sortedConstraints, sortConstraintOnIslandPredicate);
ObjectArrayList<TypedConstraint> constraintsPtr = getNumConstraints() != 0 ? sortedConstraints : null;
solverCallback.init(solverInfo, constraintSolver, constraintsPtr, sortedConstraints.size(),
debugDrawer/* ,m_stackAlloc */, dispatcher1);
constraintSolver.prepareSolve(getCollisionWorld().getNumCollisionObjects(), getCollisionWorld().getDispatcher()
.getNumManifolds());
// solve all the constraints for this island
islandManager.buildAndProcessIslands(getCollisionWorld().getDispatcher(), getCollisionWorld().getCollisionObjectArray(),
solverCallback);
constraintSolver.allSolved(solverInfo, debugDrawer/* , m_stackAlloc */);
} finally {
BulletStats.popProfile();
}
}
示例12: ShapeHull
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
public ShapeHull(ConvexShape shape) {
this.shape = shape;
this.vertices.clear();
this.indices.clear();
this.numIndices = 0;
MiscUtil.resize(unitSpherePoints, NUM_UNITSPHERE_POINTS+ConvexShape.MAX_PREFERRED_PENETRATION_DIRECTIONS*2, Vector3f.class);
for (int i=0; i<constUnitSpherePoints.size(); i++) {
unitSpherePoints.getQuick(i).set(constUnitSpherePoints.getQuick(i));
}
}
示例13: growTables
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private void growTables() {
int newCapacity = overlappingPairArray.capacity();
if (hashTable.size() < newCapacity) {
// grow hashtable and next table
int curHashtableSize = hashTable.size();
MiscUtil.resize(hashTable, newCapacity, 0);
MiscUtil.resize(next, newCapacity, 0);
for (int i=0; i<newCapacity; ++i) {
hashTable.set(i, NULL_PAIR);
}
for (int i=0; i<newCapacity; ++i) {
next.set(i, NULL_PAIR);
}
for (int i=0; i<curHashtableSize; i++) {
BroadphasePair pair = overlappingPairArray.getQuick(i);
int proxyId1 = pair.pProxy0.getUid();
int proxyId2 = pair.pProxy1.getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hashValue = getHash(proxyId1, proxyId2) & (overlappingPairArray.capacity() - 1); // New hash value with new mask
next.set(i, hashTable.get(hashValue));
hashTable.set(hashValue, i);
}
}
}
示例14: split
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private static void split(ObjectArrayList<Node> leaves, ObjectArrayList<Node> left, ObjectArrayList<Node> right, Vector3f org, Vector3f axis) {
Vector3f tmp = Stack.alloc(Vector3f.class);
MiscUtil.resize(left, 0, Node.class);
MiscUtil.resize(right, 0, Node.class);
for (int i=0, ni=leaves.size(); i<ni; i++) {
leaves.getQuick(i).volume.Center(tmp);
tmp.sub(org);
if (axis.dot(tmp) < 0f) {
left.add(leaves.getQuick(i));
}
else {
right.add(leaves.getQuick(i));
}
}
}
示例15: growTables
import com.bulletphysics.linearmath.MiscUtil; //导入依赖的package包/类
private void growTables() {
int newCapacity = overlappingPairArray.capacity();
if (hashTable.size() < newCapacity) {
// grow hashtable and next table
int curHashtableSize = hashTable.size();
MiscUtil.resize(hashTable, newCapacity, 0);
MiscUtil.resize(next, newCapacity, 0);
for (int i=0; i<newCapacity; ++i) {
hashTable.set(i, NULL_PAIR);
}
for (int i=0; i<newCapacity; ++i) {
next.set(i, NULL_PAIR);
}
for (int i=0; i<curHashtableSize; i++) {
BroadphasePair pair = overlappingPairArray.get(i);
int proxyId1 = pair.pProxy0.getUid();
int proxyId2 = pair.pProxy1.getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hashValue = getHash(proxyId1, proxyId2) & (overlappingPairArray.capacity() - 1); // New hash value with new mask
next.set(i, hashTable.get(hashValue));
hashTable.set(hashValue, i);
}
}
}