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


Java Matrix3f.setRow方法代码示例

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


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

示例1: setEulerZYX

import javax.vecmath.Matrix3f; //导入方法依赖的package包/类
/**
 * Sets rotation matrix from euler angles. The euler angles are applied in ZYX
 * order. This means a vector is first rotated about X then Y and then Z axis.
 */
public static void setEulerZYX(Matrix3f mat, float eulerX, float eulerY, float eulerZ) {
	float ci = (float) Math.cos(eulerX);
	float cj = (float) Math.cos(eulerY);
	float ch = (float) Math.cos(eulerZ);
	float si = (float) Math.sin(eulerX);
	float sj = (float) Math.sin(eulerY);
	float sh = (float) Math.sin(eulerZ);
	float cc = ci * ch;
	float cs = ci * sh;
	float sc = si * ch;
	float ss = si * sh;

	mat.setRow(0, cj * ch, sj * sc - cs, sj * cc + ss);
	mat.setRow(1, cj * sh, sj * ss + cc, sj * cs - sc);
	mat.setRow(2, -sj, cj * si, cj * ci);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:21,代码来源:MatrixUtil.java

示例2: updateWheelTransform

import javax.vecmath.Matrix3f; //导入方法依赖的package包/类
public void updateWheelTransform(int wheelIndex, boolean interpolatedTransform) {
	WheelInfo wheel = wheelInfo.getQuick(wheelIndex);
	updateWheelTransformsWS(wheel, interpolatedTransform);
	Vector3f up = Stack.alloc(Vector3f.class);
	up.negate(wheel.raycastInfo.wheelDirectionWS);
	Vector3f right = wheel.raycastInfo.wheelAxleWS;
	Vector3f fwd = Stack.alloc(Vector3f.class);
	fwd.cross(up, right);
	fwd.normalize();
	// up = right.cross(fwd);
	// up.normalize();

	// rotate around steering over de wheelAxleWS
	float steering = wheel.steering;

	Quat4f steeringOrn = Stack.alloc(Quat4f.class);
	QuaternionUtil.setRotation(steeringOrn, up, steering); //wheel.m_steering);
	Matrix3f steeringMat = Stack.alloc(Matrix3f.class);
	MatrixUtil.setRotation(steeringMat, steeringOrn);

	Quat4f rotatingOrn = Stack.alloc(Quat4f.class);
	QuaternionUtil.setRotation(rotatingOrn, right, -wheel.rotation);
	Matrix3f rotatingMat = Stack.alloc(Matrix3f.class);
	MatrixUtil.setRotation(rotatingMat, rotatingOrn);

	Matrix3f basis2 = Stack.alloc(Matrix3f.class);
	basis2.setRow(0, right.x, fwd.x, up.x);
	basis2.setRow(1, right.y, fwd.y, up.y);
	basis2.setRow(2, right.z, fwd.z, up.z);

	Matrix3f wheelBasis = wheel.worldTransform.basis;
	wheelBasis.mul(steeringMat, rotatingMat);
	wheelBasis.mul(basis2);

	wheel.worldTransform.origin.scaleAdd(wheel.raycastInfo.suspensionLength, wheel.raycastInfo.wheelDirectionWS, wheel.raycastInfo.hardPointWS);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:37,代码来源:RaycastVehicle.java

示例3: updateWheelTransform

import javax.vecmath.Matrix3f; //导入方法依赖的package包/类
public void updateWheelTransform(int wheelIndex, boolean interpolatedTransform) {
	WheelInfo wheel = wheelInfo.get(wheelIndex);
	updateWheelTransformsWS(wheel, interpolatedTransform);
	Vector3f up = Stack.alloc(Vector3f.class);
	up.negate(wheel.raycastInfo.wheelDirectionWS);
	Vector3f right = wheel.raycastInfo.wheelAxleWS;
	Vector3f fwd = Stack.alloc(Vector3f.class);
	fwd.cross(up, right);
	fwd.normalize();
	// up = right.cross(fwd);
	// up.normalize();

	// rotate around steering over de wheelAxleWS
	float steering = wheel.steering;

	Quat4f steeringOrn = Stack.alloc(Quat4f.class);
	QuaternionUtil.setRotation(steeringOrn, up, steering); //wheel.m_steering);
	Matrix3f steeringMat = Stack.alloc(Matrix3f.class);
	MatrixUtil.setRotation(steeringMat, steeringOrn);

	Quat4f rotatingOrn = Stack.alloc(Quat4f.class);
	QuaternionUtil.setRotation(rotatingOrn, right, -wheel.rotation);
	Matrix3f rotatingMat = Stack.alloc(Matrix3f.class);
	MatrixUtil.setRotation(rotatingMat, rotatingOrn);

	Matrix3f basis2 = Stack.alloc(Matrix3f.class);
	basis2.setRow(0, right.x, fwd.x, up.x);
	basis2.setRow(1, right.y, fwd.y, up.y);
	basis2.setRow(2, right.z, fwd.z, up.z);

	Matrix3f wheelBasis = wheel.worldTransform.basis;
	wheelBasis.mul(steeringMat, rotatingMat);
	wheelBasis.mul(basis2);

	wheel.worldTransform.origin.scaleAdd(wheel.raycastInfo.suspensionLength, wheel.raycastInfo.wheelDirectionWS, wheel.raycastInfo.hardPointWS);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:37,代码来源:RaycastVehicle.java


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