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


Java Vector3.length方法代码示例

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


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

示例1: calculateBounds

import org.rajawali3d.math.vector.Vector3; //导入方法依赖的package包/类
public void calculateBounds(Geometry3D geometry) {
	double radius = 0, maxRadius = 0;
	Vector3 vertex = new Vector3();
	FloatBuffer vertices = geometry.getVertices();
	vertices.rewind();		
	
	while(vertices.hasRemaining()) {
		vertex.x = vertices.get();
		vertex.y = vertices.get();
		vertex.z = vertices.get();
		
		radius = vertex.length();
		if(radius > maxRadius) maxRadius = radius;
	}
	mRadius = maxRadius;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:17,代码来源:BoundingSphere.java

示例2: fromAngleAxis

import org.rajawali3d.math.vector.Vector3; //导入方法依赖的package包/类
/**
 * Sets this {@link Quaternion}'s components from the given axis vector and angle around the axis.
 * 
 * @param x double The x component of the axis.
 * @param y double The y component of the axis.
 * @param z double The z component of the axis.
 * @param angle double The rotation angle in degrees.
 * @return A reference to this {@link Quaternion} to facilitate chaining.
 */
public Quaternion fromAngleAxis(double x, double y, double z, double angle) {
	double d = Vector3.length(x, y, z);
	if (d == 0) {
		return identity();
	}
	d = 1.0f / d;
       final double radians = Math.toRadians(angle);
	double l_ang = radians < 0 ? MathUtil.TWO_PI - (-radians % MathUtil.TWO_PI) : radians % MathUtil.TWO_PI;
	double l_sin = Math.sin(l_ang * 0.5);
	double l_cos = Math.cos(l_ang * 0.5);
	return this.setAll(l_cos, d * x * l_sin, d * y * l_sin, d * z * l_sin);
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:22,代码来源:Quaternion.java

示例3: SlerpAnimation3D

import org.rajawali3d.math.vector.Vector3; //导入方法依赖的package包/类
public SlerpAnimation3D(Vector3 from, Vector3 to) {
	super();
	mFrom = quaternionFromVector(from.clone());
	mTo = quaternionFromVector(to.clone());
	mTmpVec = new Vector3();
	mTmpQuatVector = new Vector3();
	mTmpQuat = new Quaternion();
	mDistance = from.length();
	mRotationMatrix = new double[16];
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:11,代码来源:SlerpAnimation3D.java

示例4: fromAngleAxis

import org.rajawali3d.math.vector.Vector3; //导入方法依赖的package包/类
/**
 * Sets this {@link Quaternion}'s components from the given axis vector and angle around the axis.
 *
 * @param x double The x component of the axis.
 * @param y double The y component of the axis.
 * @param z double The z component of the axis.
 * @param angle double The rotation angle in degrees.
 * @return A reference to this {@link Quaternion} to facilitate chaining.
 */
public Quaternion fromAngleAxis(double x, double y, double z, double angle) {
	double d = Vector3.length(x, y, z);
	if (d == 0) {
		return identity();
	}
	d = 1.0f / d;
       final double radians = Math.toRadians(angle);
	double l_ang = radians < 0 ? MathUtil.TWO_PI - (-radians % MathUtil.TWO_PI) : radians % MathUtil.TWO_PI;
	double l_sin = Math.sin(l_ang * 0.5);
	double l_cos = Math.cos(l_ang * 0.5);
	return this.setAll(l_cos, d * x * l_sin, d * y * l_sin, d * z * l_sin);
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:22,代码来源:Quaternion.java


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