本文整理汇总了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;
}
示例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);
}
示例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];
}
示例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);
}