本文整理汇总了Java中org.lwjgl.util.vector.Vector3f.dot方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3f.dot方法的具体用法?Java Vector3f.dot怎么用?Java Vector3f.dot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.util.vector.Vector3f
的用法示例。
在下文中一共展示了Vector3f.dot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rsi
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private static float rsi(Vec3f r0, Vec3f rd, float sr){
// Simplified ray-sphere intersection that assumes
// the ray starts inside the sphere and that the
// sphere is centered at the origin. Always intersects.
float a=Vector3f.dot(rd, rd);
float b=2*Vector3f.dot(rd, r0);
float c=Vector3f.dot(r0, r0)-sr*sr;
return (float)((-b+Math.sqrt(b*b-4.0*a*c))/(2.0*a));
}
示例2: getFacingFromVertexData
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public static EnumFacing getFacingFromVertexData(int[] faceData)
{
Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2]));
Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[7]), Float.intBitsToFloat(faceData[8]), Float.intBitsToFloat(faceData[9]));
Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[14]), Float.intBitsToFloat(faceData[15]), Float.intBitsToFloat(faceData[16]));
Vector3f vector3f3 = new Vector3f();
Vector3f vector3f4 = new Vector3f();
Vector3f vector3f5 = new Vector3f();
Vector3f.sub(vector3f, vector3f1, vector3f3);
Vector3f.sub(vector3f2, vector3f1, vector3f4);
Vector3f.cross(vector3f4, vector3f3, vector3f5);
float f = (float)Math.sqrt((double)(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z));
vector3f5.x /= f;
vector3f5.y /= f;
vector3f5.z /= f;
EnumFacing enumfacing = null;
float f1 = 0.0F;
for (EnumFacing enumfacing1 : EnumFacing.values())
{
Vec3i vec3i = enumfacing1.getDirectionVec();
Vector3f vector3f6 = new Vector3f((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
float f2 = Vector3f.dot(vector3f5, vector3f6);
if (f2 >= 0.0F && f2 > f1)
{
f1 = f2;
enumfacing = enumfacing1;
}
}
if (enumfacing == null)
{
return EnumFacing.UP;
}
else
{
return enumfacing;
}
}
示例3: getFacingFromVertexData
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public static EnumFacing getFacingFromVertexData(int[] faceData)
{
Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2]));
Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[7]), Float.intBitsToFloat(faceData[8]), Float.intBitsToFloat(faceData[9]));
Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[14]), Float.intBitsToFloat(faceData[15]), Float.intBitsToFloat(faceData[16]));
Vector3f vector3f3 = new Vector3f();
Vector3f vector3f4 = new Vector3f();
Vector3f vector3f5 = new Vector3f();
Vector3f.sub(vector3f, vector3f1, vector3f3);
Vector3f.sub(vector3f2, vector3f1, vector3f4);
Vector3f.cross(vector3f4, vector3f3, vector3f5);
float f = (float)Math.sqrt((double)(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z));
vector3f5.x /= f;
vector3f5.y /= f;
vector3f5.z /= f;
EnumFacing enumfacing = null;
float f1 = 0.0F;
for (EnumFacing enumfacing1 : EnumFacing.values())
{
Vec3i vec3i = enumfacing1.getDirectionVec();
Vector3f vector3f6 = new Vector3f((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
float f2 = Vector3f.dot(vector3f5, vector3f6);
if (f2 >= 0.0F && f2 > f1)
{
f1 = f2;
enumfacing = enumfacing1;
}
}
if (f1 < 0.719F)
{
if (enumfacing != EnumFacing.EAST && enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH && enumfacing != EnumFacing.SOUTH)
{
enumfacing = EnumFacing.UP;
}
else
{
enumfacing = EnumFacing.NORTH;
}
}
return enumfacing == null ? EnumFacing.UP : enumfacing;
}
示例4: getFacingFromVertexData
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public static EnumFacing getFacingFromVertexData(int[] faceData)
{
int i = faceData.length / 4;
int j = i * 2;
Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2]));
Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[i]), Float.intBitsToFloat(faceData[i + 1]), Float.intBitsToFloat(faceData[i + 2]));
Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[j]), Float.intBitsToFloat(faceData[j + 1]), Float.intBitsToFloat(faceData[j + 2]));
Vector3f vector3f3 = new Vector3f();
Vector3f vector3f4 = new Vector3f();
Vector3f vector3f5 = new Vector3f();
Vector3f.sub(vector3f, vector3f1, vector3f3);
Vector3f.sub(vector3f2, vector3f1, vector3f4);
Vector3f.cross(vector3f4, vector3f3, vector3f5);
float f = (float)Math.sqrt((double)(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z));
vector3f5.x /= f;
vector3f5.y /= f;
vector3f5.z /= f;
EnumFacing enumfacing = null;
float f1 = 0.0F;
for (EnumFacing enumfacing1 : EnumFacing.values())
{
Vec3i vec3i = enumfacing1.getDirectionVec();
Vector3f vector3f6 = new Vector3f((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
float f2 = Vector3f.dot(vector3f5, vector3f6);
if (f2 >= 0.0F && f2 > f1)
{
f1 = f2;
enumfacing = enumfacing1;
}
}
if (enumfacing == null)
{
return EnumFacing.UP;
}
else
{
return enumfacing;
}
}