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


Java Transform.inverse方法代码示例

本文整理汇总了Java中com.bulletphysics.linearmath.Transform.inverse方法的典型用法代码示例。如果您正苦于以下问题:Java Transform.inverse方法的具体用法?Java Transform.inverse怎么用?Java Transform.inverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.bulletphysics.linearmath.Transform的用法示例。


在下文中一共展示了Transform.inverse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTimeStepAndCounters

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public void setTimeStepAndCounters(float collisionMarginTriangle, DispatcherInfo dispatchInfo, ManifoldResult resultOut) {
	this.dispatchInfoPtr = dispatchInfo;
	this.collisionMarginTriangle = collisionMarginTriangle;
	this.resultOut = resultOut;

	Stack stack = Stack.enter();
	// recalc aabbs
	Transform convexInTriangleSpace = stack.allocTransform();

	triBody.getWorldTransform(convexInTriangleSpace);
	convexInTriangleSpace.inverse();
	convexInTriangleSpace.mul(convexBody.getWorldTransform(stack.allocTransform()));

	CollisionShape convexShape = (CollisionShape)convexBody.getCollisionShape();
	//CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
	convexShape.getAabb(convexInTriangleSpace, aabbMin, aabbMax);
	float extraMargin = collisionMarginTriangle;
	Vector3 extra = stack.allocVector3();
	extra.set(extraMargin, extraMargin, extraMargin);

	aabbMax.add(extra);
	aabbMin.sub(extra);
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:25,代码来源:ConvexTriangleCallback.java

示例2: gimpact_vs_concave

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
	// create the callback
	GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
	tricallback.algorithm = this;
	tricallback.body0 = body0;
	tricallback.body1 = body1;
	tricallback.gimpactshape0 = shape0;
	tricallback.swapped = swapped;
	tricallback.margin = shape1.getMargin();

	// getting the trimesh AABB
	Stack stack = Stack.enter();
	Transform gimpactInConcaveSpace = stack.allocTransform();

	body1.getWorldTransform(gimpactInConcaveSpace);
	gimpactInConcaveSpace.inverse();
	gimpactInConcaveSpace.mul(body0.getWorldTransform(stack.allocTransform()));

	Vector3 minAABB = stack.allocVector3(), maxAABB = stack.allocVector3();
	shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);

	shape1.processAllTriangles(tricallback, minAABB, maxAABB);
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:25,代码来源:GImpactCollisionAlgorithm.java

示例3: setTimeStepAndCounters

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public void setTimeStepAndCounters(float collisionMarginTriangle, DispatcherInfo dispatchInfo, ManifoldResult resultOut) {
	this.dispatchInfoPtr = dispatchInfo;
	this.collisionMarginTriangle = collisionMarginTriangle;
	this.resultOut = resultOut;

	// recalc aabbs
	Transform convexInTriangleSpace = Stack.alloc(Transform.class);

	triBody.getWorldTransform(convexInTriangleSpace);
	convexInTriangleSpace.inverse();
	convexInTriangleSpace.mul(convexBody.getWorldTransform(Stack.alloc(Transform.class)));

	CollisionShape convexShape = (CollisionShape)convexBody.getCollisionShape();
	//CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
	convexShape.getAabb(convexInTriangleSpace, aabbMin, aabbMax);
	float extraMargin = collisionMarginTriangle;
	Vector3f extra = Stack.alloc(Vector3f.class);
	extra.set(extraMargin, extraMargin, extraMargin);

	aabbMax.add(extra);
	aabbMin.sub(extra);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:23,代码来源:ConvexTriangleCallback.java

示例4: gimpact_vs_concave

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
	// create the callback
	GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
	tricallback.algorithm = this;
	tricallback.body0 = body0;
	tricallback.body1 = body1;
	tricallback.gimpactshape0 = shape0;
	tricallback.swapped = swapped;
	tricallback.margin = shape1.getMargin();

	// getting the trimesh AABB
	Transform gimpactInConcaveSpace = Stack.alloc(Transform.class);

	body1.getWorldTransform(gimpactInConcaveSpace);
	gimpactInConcaveSpace.inverse();
	gimpactInConcaveSpace.mul(body0.getWorldTransform(Stack.alloc(Transform.class)));

	Vector3f minAABB = Stack.alloc(Vector3f.class), maxAABB = Stack.alloc(Vector3f.class);
	shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);

	shape1.processAllTriangles(tricallback, minAABB, maxAABB);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:23,代码来源:GImpactCollisionAlgorithm.java

示例5: collideTT

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public static void collideTT (Node root0, Transform xform0, Node root1, Transform xform1, ICollide policy) {
	Stack stack = Stack.enter();
	Transform xform = stack.allocTransform();
	xform.inverse(xform0);
	xform.mul(xform1);
	collideTT(root0, root1, xform, policy);
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:9,代码来源:Dbvt.java

示例6: getAncorInA

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public Vector3 getAncorInA (Vector3 out) {
	Stack stack = Stack.enter();
	Transform tmpTrans = stack.allocTransform();

	Vector3 ancorInA = out;
	ancorInA.set(sliderAxis).scl((lowerLinLimit + upperLinLimit) * 0.5f).add(realPivotAInW);
	rbA.getCenterOfMassTransform(tmpTrans);
	tmpTrans.inverse();
	tmpTrans.transform(ancorInA);
	stack.leave();
	return ancorInA;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:13,代码来源:SliderConstraint.java

示例7: calc_from_homogenic

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
/** Calc the transformation relative 1 to 0. Inverts matrics by transposing. */
public void calc_from_homogenic (Transform trans0, Transform trans1) {
	Stack stack = Stack.enter();
	Transform temp_trans = stack.allocTransform();
	temp_trans.inverse(trans0);
	temp_trans.mul(trans1);

	T1to0.set(temp_trans.origin);
	R1to0.set(temp_trans.basis);

	calc_absolute_matrix();
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:14,代码来源:BoxCollision.java

示例8: gimpact_vs_shape_find_pairs

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
protected void gimpact_vs_shape_find_pairs(Transform trans0, Transform trans1, GImpactShapeInterface shape0, CollisionShape shape1, IntArray collided_primitives) {
	Stack stack = Stack.enter();
	AABB boxshape = stack.allocAABB();

	if (shape0.hasBoxSet()) {
		Transform trans1to0 = stack.allocTransform();
		trans1to0.inverse(trans0);
		trans1to0.mul(trans1);

		shape1.getAabb(trans1to0, boxshape.min, boxshape.max);

		shape0.getBoxSet().boxQuery(boxshape, collided_primitives);
	}
	else {
		shape1.getAabb(trans1, boxshape.min, boxshape.max);

		AABB boxshape0 = stack.allocAABB();
		int i = shape0.getNumChildShapes();

		while ((i--) != 0) {
			shape0.getChildAabb(i, trans0, boxshape0.min, boxshape0.max);

			if (boxshape.has_collision(boxshape0)) {
				collided_primitives.add(i);
			}
		}
	}
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:30,代码来源:GImpactCollisionAlgorithm.java

示例9: getAncorInA

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public Vector3f getAncorInA(Vector3f out) {
	Transform tmpTrans = Stack.alloc(Transform.class);

	Vector3f ancorInA = out;
	ancorInA.scaleAdd((lowerLinLimit + upperLinLimit) * 0.5f, sliderAxis, realPivotAInW);
	rbA.getCenterOfMassTransform(tmpTrans);
	tmpTrans.inverse();
	tmpTrans.transform(ancorInA);
	return ancorInA;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:11,代码来源:SliderConstraint.java

示例10: calc_from_homogenic

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
/**
 * Calc the transformation relative  1 to 0. Inverts matrics by transposing.
 */
public void calc_from_homogenic(Transform trans0, Transform trans1) {
	Transform temp_trans = Stack.alloc(Transform.class);
	temp_trans.inverse(trans0);
	temp_trans.mul(trans1);

	T1to0.set(temp_trans.origin);
	R1to0.set(temp_trans.basis);

	calc_absolute_matrix();
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:14,代码来源:BoxCollision.java

示例11: gimpact_vs_shape_find_pairs

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
protected void gimpact_vs_shape_find_pairs(Transform trans0, Transform trans1, GImpactShapeInterface shape0, CollisionShape shape1, IntArrayList collided_primitives) {
	AABB boxshape = Stack.alloc(AABB.class);

	if (shape0.hasBoxSet()) {
		Transform trans1to0 = Stack.alloc(Transform.class);
		trans1to0.inverse(trans0);
		trans1to0.mul(trans1);

		shape1.getAabb(trans1to0, boxshape.min, boxshape.max);

		shape0.getBoxSet().boxQuery(boxshape, collided_primitives);
	}
	else {
		shape1.getAabb(trans1, boxshape.min, boxshape.max);

		AABB boxshape0 = Stack.alloc(AABB.class);
		int i = shape0.getNumChildShapes();

		while ((i--) != 0) {
			shape0.getChildAabb(i, trans0, boxshape0.min, boxshape0.max);

			if (boxshape.has_collision(boxshape0)) {
				collided_primitives.add(i);
			}
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:28,代码来源:GImpactCollisionAlgorithm.java

示例12: getWorldTransform

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
@Override
public Transform getWorldTransform(Transform out){
	out.inverse(centerOfMassOffset);
	out.mul(graphicsWorldTrans);
	return out;
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:7,代码来源:MotionStateM.java

示例13: processCollision

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
@Override
public void processCollision (CollisionObject body0, CollisionObject body1, DispatcherInfo dispatchInfo,
	ManifoldResult resultOut) {
	if (manifoldPtr == null) {
		return;
	}

	Stack stack = Stack.enter();
	Transform tmpTrans = stack.allocTransform();

	CollisionObject convexObj = isSwapped ? body1 : body0;
	CollisionObject planeObj = isSwapped ? body0 : body1;

	ConvexShape convexShape = (ConvexShape)convexObj.getCollisionShape();
	StaticPlaneShape planeShape = (StaticPlaneShape)planeObj.getCollisionShape();

	boolean hasCollision = false;
	Vector3 planeNormal = planeShape.getPlaneNormal(stack.allocVector3());
	float planeConstant = planeShape.getPlaneConstant();

	Transform planeInConvex = stack.allocTransform();
	convexObj.getWorldTransform(planeInConvex);
	planeInConvex.inverse();
	planeInConvex.mul(planeObj.getWorldTransform(tmpTrans));

	Transform convexInPlaneTrans = stack.allocTransform();
	convexInPlaneTrans.inverse(planeObj.getWorldTransform(tmpTrans));
	convexInPlaneTrans.mul(convexObj.getWorldTransform(tmpTrans));

	Vector3 tmp = stack.allocVector3();
	tmp.set(planeNormal).scl(-1);
	tmp.mul(planeInConvex.basis);

	Vector3 vtx = convexShape.localGetSupportingVertex(tmp, stack.allocVector3());
	Vector3 vtxInPlane = stack.alloc(vtx);
	convexInPlaneTrans.transform(vtxInPlane);

	float distance = (planeNormal.dot(vtxInPlane) - planeConstant);

	Vector3 vtxInPlaneProjected = stack.allocVector3();
	tmp.set(planeNormal).scl(distance);
	vtxInPlaneProjected.set(vtxInPlane).sub(tmp);

	Vector3 vtxInPlaneWorld = stack.alloc(vtxInPlaneProjected);
	planeObj.getWorldTransform(tmpTrans).transform(vtxInPlaneWorld);

	hasCollision = distance < manifoldPtr.getContactBreakingThreshold();
	resultOut.setPersistentManifold(manifoldPtr);
	if (hasCollision) {
		// report a contact. internally this will be kept persistent, and contact reduction is done
		Vector3 normalOnSurfaceB = stack.alloc(planeNormal);
		normalOnSurfaceB.mul(planeObj.getWorldTransform(tmpTrans).basis);

		Vector3 pOnB = stack.alloc(vtxInPlaneWorld);
		resultOut.addContactPoint(normalOnSurfaceB, pOnB, distance);
	}
	if (ownManifold) {
		if (manifoldPtr.getNumContacts() != 0) {
			resultOut.refreshContactPoints();
		}
	}
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:64,代码来源:ConvexPlaneCollisionAlgorithm.java

示例14: calculateTimeOfImpact

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
@Override
public float calculateTimeOfImpact (CollisionObject body0, CollisionObject body1, DispatcherInfo dispatchInfo,
	ManifoldResult resultOut) {
	Stack stack = Stack.enter();
	Vector3 tmp = stack.allocVector3();

	CollisionObject convexbody = isSwapped ? body1 : body0;
	CollisionObject triBody = isSwapped ? body0 : body1;

	// quick approximation using raycast, todo: hook up to the continuous collision detection (one of the btConvexCast)

	// only perform CCD above a certain threshold, this prevents blocking on the long run
	// because object in a blocked ccd state (hitfraction<1) get their linear velocity halved each frame...
	tmp.set(convexbody.getInterpolationWorldTransform(stack.allocTransform()).origin)
		.sub(convexbody.getWorldTransform(stack.allocTransform()).origin);
	float squareMot0 = tmp.len2();
	if (squareMot0 < convexbody.getCcdSquareMotionThreshold()) {
		stack.leave();
		return 1f;
	}

	Transform tmpTrans = stack.allocTransform();

	// const btVector3& from = convexbody->m_worldTransform.getOrigin();
	// btVector3 to = convexbody->m_interpolationWorldTransform.getOrigin();
	// todo: only do if the motion exceeds the 'radius'

	Transform triInv = triBody.getWorldTransform(stack.allocTransform());
	triInv.inverse();

	Transform convexFromLocal = stack.allocTransform();
	convexFromLocal.mul(triInv, convexbody.getWorldTransform(tmpTrans));

	Transform convexToLocal = stack.allocTransform();
	convexToLocal.mul(triInv, convexbody.getInterpolationWorldTransform(tmpTrans));

	if (triBody.getCollisionShape().isConcave()) {
		Vector3 rayAabbMin = stack.alloc(convexFromLocal.origin);
		VectorUtil.setMin(rayAabbMin, convexToLocal.origin);

		Vector3 rayAabbMax = stack.alloc(convexFromLocal.origin);
		VectorUtil.setMax(rayAabbMax, convexToLocal.origin);

		float ccdRadius0 = convexbody.getCcdSweptSphereRadius();

		tmp.set(ccdRadius0, ccdRadius0, ccdRadius0);
		rayAabbMin.sub(tmp);
		rayAabbMax.add(tmp);

		float curHitFraction = 1f; // is this available?
		LocalTriangleSphereCastCallback raycastCallback = new LocalTriangleSphereCastCallback(convexFromLocal, convexToLocal,
			convexbody.getCcdSweptSphereRadius(), curHitFraction);

		raycastCallback.hitFraction = convexbody.getHitFraction();

		CollisionObject concavebody = triBody;

		ConcaveShape triangleMesh = (ConcaveShape)concavebody.getCollisionShape();

		if (triangleMesh != null) {
			triangleMesh.processAllTriangles(raycastCallback, rayAabbMin, rayAabbMax);
		}

		if (raycastCallback.hitFraction < convexbody.getHitFraction()) {
			convexbody.setHitFraction(raycastCallback.hitFraction);
			stack.leave();
			return raycastCallback.hitFraction;
		}
	}

	stack.leave();
	return 1f;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:74,代码来源:ConvexConcaveCollisionAlgorithm.java

示例15: collideTT

import com.bulletphysics.linearmath.Transform; //导入方法依赖的package包/类
public static void collideTT(Node root0, Transform xform0, Node root1, Transform xform1, ICollide policy) {
	Transform xform = Stack.alloc(Transform.class);
	xform.inverse(xform0);
	xform.mul(xform1);
	collideTT(root0, root1, xform, policy);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:7,代码来源:Dbvt.java


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