当前位置: 首页>>代码示例>>Java>>正文


Java MiscUtil类代码示例

本文整理汇总了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();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:18,代码来源:Dbvt.java

示例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);
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:22,代码来源:UnionFind.java

示例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;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:25,代码来源:HullLibrary.java

示例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;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:25,代码来源:HullLibrary.java

示例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();
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:27,代码来源:DiscreteDynamicsWorld.java

示例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);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:UnionFind.java

示例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;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:25,代码来源:HullLibrary.java

示例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();
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:27,代码来源:DiscreteDynamicsWorld.java

示例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));
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:12,代码来源:ShapeHull.java

示例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);
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:31,代码来源:HashedOverlappingPairCache.java

示例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();
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:29,代码来源:DiscreteDynamicsWorld.java

示例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));
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:12,代码来源:ShapeHull.java

示例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);
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:31,代码来源:HashedOverlappingPairCache.java

示例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));
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:16,代码来源:Dbvt.java

示例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);
		}
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:31,代码来源:HashedOverlappingPairCache.java


注:本文中的com.bulletphysics.linearmath.MiscUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。