本文整理汇总了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();
}
示例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();
}
示例3: alloc
import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
public Matrix3 alloc(Matrix3 original) {
Matrix3 m = allocMatrix3();
m.set(original);
return m;
}
示例4: getInvInertiaTensorWorld
import com.badlogic.gdx.math.Matrix3; //导入方法依赖的package包/类
public Matrix3 getInvInertiaTensorWorld (Matrix3 out) {
out.set(invInertiaTensorWorld);
return out;
}
示例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();
}