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


Java Matrix3.set方法代码示例

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


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

示例1: getAabb

import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
@Override
public void getAabb (Transform t, Vector3 aabbMin, Vector3 aabbMax) {
	Stack stack = Stack.enter();
	Vector3 tmp = stack.allocVector3();

	Vector3 halfExtents = stack.allocVector3();
	halfExtents.set(getRadius(), getRadius(), getRadius());
	VectorUtil.setCoord(halfExtents, upAxis, getRadius() + getHalfHeight());

	halfExtents.x += getMargin();
	halfExtents.y += getMargin();
	halfExtents.z += getMargin();

	Matrix3 abs_b = stack.allocMatrix3();
	abs_b.set(t.basis);
	MatrixUtil.absolute(abs_b);

	Vector3 center = t.origin;
	Vector3 extent = stack.allocVector3();

	MatrixUtil.getRow(abs_b, 0, tmp);
	extent.x = tmp.dot(halfExtents);
	MatrixUtil.getRow(abs_b, 1, tmp);
	extent.y = tmp.dot(halfExtents);
	MatrixUtil.getRow(abs_b, 2, tmp);
	extent.z = tmp.dot(halfExtents);

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

示例2: calculateDiffAxisAngle

import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
public static void calculateDiffAxisAngle (Transform transform0, Transform transform1, Vector3 axis, float[] angle) {
// #ifdef USE_QUATERNION_DIFF
// btQuaternion orn0 = transform0.getRotation();
// btQuaternion orn1a = transform1.getRotation();
// btQuaternion orn1 = orn0.farthest(orn1a);
// btQuaternion dorn = orn1 * orn0.inverse();
// #else
		Stack stack = Stack.enter();
		Matrix3 tmp = stack.allocMatrix3();
		tmp.set(transform0.basis);
		MatrixUtil.invert(tmp);

		Matrix3 dmat = stack.allocMatrix3();
		dmat.set(transform1.basis).mul(tmp);

		Quaternion dorn = stack.allocQuaternion();
		MatrixUtil.getRotation(dmat, dorn);
// #endif

		// floating point inaccuracy can lead to w component > 1..., which breaks

		dorn.nor();

		angle[0] = QuaternionUtil.getAngle(dorn);
		axis.set(dorn.x, dorn.y, dorn.z);
		// TODO: probably not needed
		// axis[3] = btScalar(0.);

		// check for axis length
		float len = axis.len2();
		if (len < BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON) {
			axis.set(1f, 0f, 0f);
		} else {
			axis.scl(1f / (float)Math.sqrt(len));
		}
		stack.leave();
	}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:38,代码来源:TransformUtil.java

示例3: alloc

import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
public Matrix3 alloc(Matrix3 original) {
	Matrix3 m = allocMatrix3();
	m.set(original);
	return m;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:6,代码来源:Stack.java

示例4: getInvInertiaTensorWorld

import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
public Matrix3 getInvInertiaTensorWorld (Matrix3 out) {
	out.set(invInertiaTensorWorld);
	return out;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:5,代码来源:RigidBody.java

示例5: calculateAngleInfo

import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
/** Calcs the euler angles between the two bodies. */
protected void calculateAngleInfo () {
	Stack stack = Stack.enter();
	Matrix3 mat = stack.allocMatrix3();

	Matrix3 relative_frame = stack.allocMatrix3();
	mat.set(calculatedTransformA.basis);
	MatrixUtil.invert(mat);
	relative_frame.set(mat).mul(calculatedTransformB.basis);

	matrixToEulerXYZ(relative_frame, calculatedAxisAngleDiff);

	// in euler angle mode we do not actually constrain the angular velocity
	// along the axes axis[0] and axis[2] (although we do use axis[1]) :
	//
	// to get constrain w2-w1 along ...not
	// ------ --------------------- ------
	// d(angle[0])/dt = 0 ax[1] x ax[2] ax[0]
	// d(angle[1])/dt = 0 ax[1]
	// d(angle[2])/dt = 0 ax[0] x ax[1] ax[2]
	//
	// constraining w2-w1 along an axis 'a' means that a'*(w2-w1)=0.
	// to prove the result for angle[0], write the expression for angle[0] from
	// GetInfo1 then take the derivative. to prove this for angle[2] it is
	// easier to take the euler rate expression for d(angle[2])/dt with respect
	// to the components of w and set that to 0.

	Vector3 axis0 = stack.allocVector3();
	MatrixUtil.getColumn(calculatedTransformB.basis, 0, axis0);

	Vector3 axis2 = stack.allocVector3();
	MatrixUtil.getColumn(calculatedTransformA.basis, 2, axis2);

	calculatedAxis[1].set(axis2).crs(axis0);
	calculatedAxis[0].set(calculatedAxis[1]).crs(axis2);
	calculatedAxis[2].set(axis0).crs(calculatedAxis[1]);

	// if(m_debugDrawer)
	// {
	//
	// char buff[300];
	// sprintf(buff,"\n X: %.2f ; Y: %.2f ; Z: %.2f ",
	// m_calculatedAxisAngleDiff[0],
	// m_calculatedAxisAngleDiff[1],
	// m_calculatedAxisAngleDiff[2]);
	// m_debugDrawer->reportErrorWarning(buff);
	// }
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:50,代码来源:Generic6DofConstraint.java


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