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


Java Vector4f.set方法代码示例

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


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

示例1: getPlaneEquation

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
public void getPlaneEquation(Vector4f plane, int i) {
	Vector3f halfExtents = getHalfExtentsWithoutMargin(Stack.alloc(Vector3f.class));

	switch (i) {
		case 0:
			plane.set(1f, 0f, 0f, -halfExtents.x);
			break;
		case 1:
			plane.set(-1f, 0f, 0f, -halfExtents.x);
			break;
		case 2:
			plane.set(0f, 1f, 0f, -halfExtents.y);
			break;
		case 3:
			plane.set(0f, -1f, 0f, -halfExtents.y);
			break;
		case 4:
			plane.set(0f, 0f, 1f, -halfExtents.z);
			break;
		case 5:
			plane.set(0f, 0f, -1f, -halfExtents.z);
			break;
		default:
			assert (false);
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:27,代码来源:BoxShape.java

示例2: get_plane_equation_transformed

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
public static void get_plane_equation_transformed(StaticPlaneShape shape, Transform trans, Vector4f equation) {
	get_plane_equation(shape, equation);

	Vector3f tmp = Stack.alloc(Vector3f.class);

	trans.basis.getRow(0, tmp);
	float x = VectorUtil.dot3(tmp, equation);
	trans.basis.getRow(1, tmp);
	float y = VectorUtil.dot3(tmp, equation);
	trans.basis.getRow(2, tmp);
	float z = VectorUtil.dot3(tmp, equation);

	float w = VectorUtil.dot3(trans.origin, equation) + equation.w;

	equation.set(x, y, z, w);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:17,代码来源:PlaneShape.java

示例3: buildTriPlane

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
public void buildTriPlane(Vector4f plane) {
	Vector3f tmp1 = Stack.alloc(Vector3f.class);
	Vector3f tmp2 = Stack.alloc(Vector3f.class);

	Vector3f normal = Stack.alloc(Vector3f.class);
	tmp1.sub(vertices1[1], vertices1[0]);
	tmp2.sub(vertices1[2], vertices1[0]);
	normal.cross(tmp1, tmp2);
	normal.normalize();

	plane.set(normal.x, normal.y, normal.z, vertices1[0].dot(normal));
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:13,代码来源:TriangleShapeEx.java

示例4: edge_plane

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
 * Calc a plane from a triangle edge an a normal.
 */
public static void edge_plane(Vector3f e1, Vector3f e2, Vector3f normal, Vector4f plane) {
	Vector3f planenormal = Stack.alloc(Vector3f.class);
	planenormal.sub(e2, e1);
	planenormal.cross(planenormal, normal);
	planenormal.normalize();

	plane.set(planenormal);
	plane.w = e2.dot(planenormal);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:13,代码来源:GeometryOperations.java

示例5: segment_collision

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
 * Find closest points on segments.
 */
public static void segment_collision(Vector3f vA1, Vector3f vA2, Vector3f vB1, Vector3f vB2, Vector3f vPointA, Vector3f vPointB) {
	Vector3f AD = Stack.alloc(Vector3f.class);
	AD.sub(vA2, vA1);

	Vector3f BD = Stack.alloc(Vector3f.class);
	BD.sub(vB2, vB1);

	Vector3f N = Stack.alloc(Vector3f.class);
	N.cross(AD, BD);
	float[] tp = new float[] { N.lengthSquared() };

	Vector4f _M = Stack.alloc(Vector4f.class);//plane

	if (tp[0] < BulletGlobals.SIMD_EPSILON)//ARE PARALELE
	{
		// project B over A
		boolean invert_b_order = false;
		_M.x = vB1.dot(AD);
		_M.y = vB2.dot(AD);

		if (_M.x > _M.y) {
			invert_b_order = true;
			//BT_SWAP_NUMBERS(_M[0],_M[1]);
			_M.x = _M.x + _M.y;
			_M.y = _M.x - _M.y;
			_M.x = _M.x - _M.y;
		}
		_M.z = vA1.dot(AD);
		_M.w = vA2.dot(AD);
		// mid points
		N.x = (_M.x + _M.y) * 0.5f;
		N.y = (_M.z + _M.w) * 0.5f;

		if (N.x < N.y) {
			if (_M.y < _M.z) {
				vPointB = invert_b_order ? vB1 : vB2;
				vPointA = vA1;
			}
			else if (_M.y < _M.w) {
				vPointB = invert_b_order ? vB1 : vB2;
				closest_point_on_segment(vPointA, vPointB, vA1, vA2);
			}
			else {
				vPointA = vA2;
				closest_point_on_segment(vPointB, vPointA, vB1, vB2);
			}
		}
		else {
			if (_M.w < _M.x) {
				vPointB = invert_b_order ? vB2 : vB1;
				vPointA = vA2;
			}
			else if (_M.w < _M.y) {
				vPointA = vA2;
				closest_point_on_segment(vPointB, vPointA, vB1, vB2);
			}
			else {
				vPointB = invert_b_order ? vB1 : vB2;
				closest_point_on_segment(vPointA, vPointB, vA1, vA2);
			}
		}
		return;
	}

	N.cross(N, BD);
	_M.set(N.x, N.y, N.z, vB1.dot(N));

	// get point A as the plane collision point
	line_plane_collision(_M, AD, vA1, vPointA, tp, 0f, 1f);

	/*Closest point on segment*/
	vPointB.sub(vPointA, vB1);
	tp[0] = vPointB.dot(BD);
	tp[0] /= BD.dot(BD);
	tp[0] = CLAMP(tp[0], 0.0f, 1.0f);

	vPointB.scaleAdd(tp[0], BD, vB1);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:82,代码来源:GeometryOperations.java

示例6: get_plane_equation

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
public static void get_plane_equation(StaticPlaneShape shape, Vector4f equation) {
	Vector3f tmp = Stack.alloc(Vector3f.class);
	equation.set(shape.getPlaneNormal(tmp));
	equation.w = shape.getPlaneConstant();
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:6,代码来源:PlaneShape.java

示例7: getPlaneS

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
    * Retrieves a copy of the plane equation used to
    * generate the S coordinate.
    * @param planeS the S coordinate plane equation
    */
   final void getPlaneS(Vector4f planeS) {
planeS.set(this.planeS);
   }
 
开发者ID:philipwhiuk,项目名称:j3d-core,代码行数:9,代码来源:TexCoordGenerationRetained.java

示例8: getPlaneT

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
    * Retrieves a copy of the plane equation used to
    * generate the T coordinate.
    * @param planeT the T coordinate plane equation
    */
   final void getPlaneT(Vector4f planeT) {
planeT.set(this.planeT);
   }
 
开发者ID:philipwhiuk,项目名称:j3d-core,代码行数:9,代码来源:TexCoordGenerationRetained.java

示例9: getPlaneR

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
    * Retrieves a copy of the plane equation used to
    * generate the R coordinate.
    * @param planeR the R coordinate plane equation
    */
   final void getPlaneR(Vector4f planeR) {
planeR.set(this.planeR);
   }
 
开发者ID:philipwhiuk,项目名称:j3d-core,代码行数:9,代码来源:TexCoordGenerationRetained.java

示例10: getPlaneQ

import javax.vecmath.Vector4f; //导入方法依赖的package包/类
/**
 * Retrieves a copy of the plane equation used to
 * generate the Q coordinate.
 * @param planeQ the Q coordinate plane equation
 */
final void getPlaneQ(Vector4f planeQ) {
    planeQ.set(this.planeQ);
}
 
开发者ID:philipwhiuk,项目名称:j3d-core,代码行数:9,代码来源:TexCoordGenerationRetained.java


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