Java Code Examples for org.lwjgl.util.vector.Vector3f#dot()
The following examples show how to use
org.lwjgl.util.vector.Vector3f#dot() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BillboardPainter.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
private final static void initClipPlane(int clip_enum, int face_index, int vertex_index1, int vertex_index2, short[] indices, float[] face_tex_coords, float handedness) { float u1 = getElement(face_index, vertex_index1, 0, 2, indices, face_tex_coords); float v1 = getElement(face_index, vertex_index1, 1, 2, indices, face_tex_coords); float u2 = getElement(face_index, vertex_index2, 0, 2, indices, face_tex_coords); float v2 = getElement(face_index, vertex_index2, 1, 2, indices, face_tex_coords); Vector3f vec1 = new Vector3f(0f, 0f, 1f); Vector3f vec2 = new Vector3f(u2 - u1, v2 - v1, 0); Vector3f vec3 = new Vector3f(); Vector3f.cross(vec1, vec2, vec3); vec3.scale(handedness); vec3.normalise(); vec1.set(u1, v1, 0f); float d = -Vector3f.dot(vec3, vec1); plane_buf.put(0, vec3.x).put(1, vec3.y).put(2, vec3.z).put(3, d); GL11.glClipPlane(clip_enum, plane_buf); }
Example 2
Source File: Trackball.java From OpenModsLib with MIT License | 6 votes |
private Matrix4f getTransform(float mouseX, float mouseY) { Preconditions.checkNotNull(dragStart, "Draging not started"); Vector3f current = calculateSpherePoint(mouseX, mouseY); float dot = Vector3f.dot(dragStart, current); if (Math.abs(dot - 1) < 0.0001) return lastTransform; Vector3f axis = Vector3f.cross(dragStart, current, null); try { axis.normalise(); } catch (IllegalStateException e) { // Zero length vector return lastTransform; } float angle = 2 * (float)(Math.acos(dot)); Matrix4f rotation = new Matrix4f(); rotation.rotate(angle, axis); return Matrix4f.mul(rotation, lastTransform, null); }
Example 3
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static ct a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; ct var8 = null; float var9 = 0.0F; ct[] var10 = ct.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { ct var13 = var10[var12]; di var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return ct.b; } else { return var8; } }
Example 4
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cq a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cq var8 = null; float var9 = 0.0F; cq[] var10 = cq.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cq var13 = var10[var12]; df var14 = var13.m(); Vector3f var15 = new Vector3f((float) var14.n(), (float) var14.o(), (float) var14.p()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cq.b; } else { return var8; } }
Example 5
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cs a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cs var8 = null; float var9 = 0.0F; cs[] var10 = cs.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cs var13 = var10[var12]; dh var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cs.b; } else { return var8; } }
Example 6
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cv a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cv var8 = null; float var9 = 0.0F; cv[] var10 = cv.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cv var13 = var10[var12]; dl var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cv.b; } else { return var8; } }
Example 7
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static fa a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; fa var8 = null; float var9 = 0.0F; fa[] var10 = fa.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { fa var13 = var10[var12]; fq var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return fa.b; } else { return var8; } }
Example 8
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cq a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cq var8 = null; float var9 = 0.0F; cq[] var10 = cq.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cq var13 = var10[var12]; df var14 = var13.m(); Vector3f var15 = new Vector3f((float) var14.n(), (float) var14.o(), (float) var14.p()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cq.b; } else { return var8; } }
Example 9
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cv a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cv var8 = null; float var9 = 0.0F; cv[] var10 = cv.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cv var13 = var10[var12]; dl var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cv.b; } else { return var8; } }
Example 10
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static ct a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; ct var8 = null; float var9 = 0.0F; ct[] var10 = ct.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { ct var13 = var10[var12]; di var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return ct.b; } else { return var8; } }
Example 11
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static cq a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; cq var8 = null; float var9 = 0.0F; cq[] var10 = cq.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { cq var13 = var10[var12]; df var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return cq.b; } else { return var8; } }
Example 12
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
public static fa a(int[] var) { Vector3f var1 = new Vector3f(Float.intBitsToFloat(var[0]), Float.intBitsToFloat(var[1]), Float.intBitsToFloat(var[2])); Vector3f var2 = new Vector3f(Float.intBitsToFloat(var[7]), Float.intBitsToFloat(var[8]), Float.intBitsToFloat(var[9])); Vector3f var3 = new Vector3f(Float.intBitsToFloat(var[14]), Float.intBitsToFloat(var[15]), Float.intBitsToFloat(var[16])); Vector3f var4 = new Vector3f(); Vector3f var5 = new Vector3f(); Vector3f var6 = new Vector3f(); Vector3f.sub(var1, var2, var4); Vector3f.sub(var3, var2, var5); Vector3f.cross(var5, var4, var6); float var7 = (float) Math.sqrt((double) (var6.x * var6.x + var6.y * var6.y + var6.z * var6.z)); var6.x /= var7; var6.y /= var7; var6.z /= var7; fa var8 = null; float var9 = 0.0F; fa[] var10 = fa.values(); int var11 = var10.length; for (int var12 = 0; var12 < var11; ++var12) { fa var13 = var10[var12]; fq var14 = var13.n(); Vector3f var15 = new Vector3f((float) var14.p(), (float) var14.q(), (float) var14.r()); float var16 = Vector3f.dot(var6, var15); if (var16 >= 0.0F && var16 > var9) { var9 = var16; var8 = var13; } } if (var8 == null) { return fa.b; } else { return var8; } }
Example 13
Source File: Trackball.java From OpenModsLib with MIT License | 3 votes |
private static Vector3f calculateSpherePoint(float x, float y) { Vector3f result = new Vector3f(x, y, 0); float sqrZ = 1 - Vector3f.dot(result, result); if (sqrZ > 0) result.z = (float)Math.sqrt(sqrZ); else result.normalise(); return result; }