本文整理汇总了Java中com.bulletphysics.linearmath.MiscUtil.quickSort方法的典型用法代码示例。如果您正苦于以下问题:Java MiscUtil.quickSort方法的具体用法?Java MiscUtil.quickSort怎么用?Java MiscUtil.quickSort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bulletphysics.linearmath.MiscUtil
的用法示例。
在下文中一共展示了MiscUtil.quickSort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
}
}
示例3: 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);
}
示例4: 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();
}
}
示例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: calculateOverlappingPairs
import com.bulletphysics.linearmath.MiscUtil; //导入方法依赖的package包/类
public void calculateOverlappingPairs (Dispatcher dispatcher) {
if (pairCache.hasDeferredRemoval()) {
ObjectArrayList<BroadphasePair> overlappingPairArray = pairCache.getOverlappingPairArray();
// perform a sort, to find duplicates and to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, NEW_BROADPHASE_PAIR_SUPPLIER);
invalidPair = 0;
int i;
BroadphasePair previousPair = new BroadphasePair();
previousPair.pProxy0 = null;
previousPair.pProxy1 = null;
previousPair.algorithm = null;
for (i = 0; i < overlappingPairArray.size(); i++) {
BroadphasePair pair = overlappingPairArray.getQuick(i);
boolean isDuplicate = (pair.equals(previousPair));
previousPair.set(pair);
boolean needsRemoval = false;
if (!isDuplicate) {
boolean hasOverlap = testAabbOverlap(pair.pProxy0, pair.pProxy1);
if (hasOverlap) {
needsRemoval = false;// callback->processOverlap(pair);
} else {
needsRemoval = true;
}
} else {
// remove duplicate
needsRemoval = true;
// should have no algorithm
assert (pair.algorithm == null);
}
if (needsRemoval) {
pairCache.cleanOverlappingPair(pair, dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.pProxy0 = null;
pair.pProxy1 = null;
invalidPair++;
BulletStats.gOverlappingPairs--;
}
}
// if you don't like to skip the invalid pairs in the array, execute following code:
// #define CLEAN_INVALID_PAIRS 1
// #ifdef CLEAN_INVALID_PAIRS
// perform a sort, to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, NEW_BROADPHASE_PAIR_SUPPLIER);
invalidPair = 0;
// #endif//CLEAN_INVALID_PAIRS
// printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}
示例7: calculateOverlappingPairs
import com.bulletphysics.linearmath.MiscUtil; //导入方法依赖的package包/类
public void calculateOverlappingPairs(Dispatcher dispatcher) {
if (pairCache.hasDeferredRemoval()) {
ObjectArrayList<BroadphasePair> overlappingPairArray = pairCache.getOverlappingPairArray();
// perform a sort, to find duplicates and to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, BroadphasePair.class);
invalidPair = 0;
int i;
BroadphasePair previousPair = new BroadphasePair();
previousPair.pProxy0 = null;
previousPair.pProxy1 = null;
previousPair.algorithm = null;
for (i=0; i<overlappingPairArray.size(); i++) {
BroadphasePair pair = overlappingPairArray.getQuick(i);
boolean isDuplicate = (pair.equals(previousPair));
previousPair.set(pair);
boolean needsRemoval = false;
if (!isDuplicate) {
boolean hasOverlap = testAabbOverlap(pair.pProxy0, pair.pProxy1);
if (hasOverlap) {
needsRemoval = false;//callback->processOverlap(pair);
}
else {
needsRemoval = true;
}
}
else {
// remove duplicate
needsRemoval = true;
// should have no algorithm
assert (pair.algorithm == null);
}
if (needsRemoval) {
pairCache.cleanOverlappingPair(pair, dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.pProxy0 = null;
pair.pProxy1 = null;
invalidPair++;
BulletStats.gOverlappingPairs--;
}
}
// if you don't like to skip the invalid pairs in the array, execute following code:
//#define CLEAN_INVALID_PAIRS 1
//#ifdef CLEAN_INVALID_PAIRS
// perform a sort, to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, BroadphasePair.class);
invalidPair = 0;
//#endif//CLEAN_INVALID_PAIRS
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}
示例8: calculateOverlappingPairs
import com.bulletphysics.linearmath.MiscUtil; //导入方法依赖的package包/类
public void calculateOverlappingPairs(Dispatcher dispatcher) {
if (pairCache.hasDeferredRemoval()) {
List<BroadphasePair> overlappingPairArray = pairCache.getOverlappingPairArray();
// perform a sort, to find duplicates and to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, BroadphasePair.class);
invalidPair = 0;
int i;
BroadphasePair previousPair = new BroadphasePair();
previousPair.pProxy0 = null;
previousPair.pProxy1 = null;
previousPair.algorithm = null;
for (i=0; i<overlappingPairArray.size(); i++) {
BroadphasePair pair = overlappingPairArray.get(i);
boolean isDuplicate = (pair.equals(previousPair));
previousPair.set(pair);
boolean needsRemoval = false;
if (!isDuplicate) {
boolean hasOverlap = testAabbOverlap(pair.pProxy0, pair.pProxy1);
if (hasOverlap) {
needsRemoval = false;//callback->processOverlap(pair);
}
else {
needsRemoval = true;
}
}
else {
// remove duplicate
needsRemoval = true;
// should have no algorithm
assert (pair.algorithm == null);
}
if (needsRemoval) {
pairCache.cleanOverlappingPair(pair, dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.pProxy0 = null;
pair.pProxy1 = null;
invalidPair++;
BulletStats.gOverlappingPairs--;
}
}
// if you don't like to skip the invalid pairs in the array, execute following code:
//#define CLEAN_INVALID_PAIRS 1
//#ifdef CLEAN_INVALID_PAIRS
// perform a sort, to sort 'invalid' pairs to the end
MiscUtil.quickSort(overlappingPairArray, BroadphasePair.broadphasePairSortPredicate);
MiscUtil.resize(overlappingPairArray, overlappingPairArray.size() - invalidPair, BroadphasePair.class);
invalidPair = 0;
//#endif//CLEAN_INVALID_PAIRS
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}