本文整理匯總了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;
}
}