/** * <code>intersectWhere</code> determines if the Ray intersects a triangle. It then * stores the point of intersection in the given loc vector * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) * @return true if the ray collides. */ public boolean intersectWhere(Triangle t, Vector3f loc) { return intersectWhere(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>intersectWherePlanar</code> determines if the Ray intersects a * triangle and if so it stores the point of * intersection in the given loc vector as t, u, v where t is the distance * from the origin to the point of intersection and u,v is the intersection * point in terms of the triangle plane. * * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) as t, u, v * @return true if the ray collides. */ public boolean intersectWherePlanar(Triangle t, Vector3f loc) { return intersectWherePlanar(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>computeFromTris</code> creates a new Bounding Box from a given * set of triangles. It is used in OBBTree calculations. * * @param tris * @param start * @param end */ public void computeFromTris(Triangle[] tris, int start, int end) { if (end - start <= 0) { return; } Vector3f[] vertList = new Vector3f[(end - start) * 3]; int count = 0; for (int i = start; i < end; i++) { vertList[count++] = tris[i].get(0); vertList[count++] = tris[i].get(1); vertList[count++] = tris[i].get(2); } averagePoints(vertList); } //
t.get(0).x = (gridX); t.get(0).y = (h1); t.get(0).z = (gridY); t.get(1).x = (gridX); t.get(1).y = (h3); t.get(1).z = (gridY + 1); t.get(2).x = (gridX + 1); t.get(2).y = (h4); t.get(2).z = (gridY + 1); t2.get(0).x = (gridX); t2.get(0).y = (h1); t2.get(0).z = (gridY); t2.get(1).x = (gridX + 1); t2.get(1).y = (h4); t2.get(1).z = (gridY + 1); t2.get(2).x = (gridX + 1); t2.get(2).y = (h2); t2.get(2).z = (gridY); } else { t.get(0).x = (gridX); t.get(0).y = (h1); t.get(0).z = (gridY);
public void computeFromTris(int[] indices, Mesh mesh, int start, int end) { if (end - start <= 0) { return; } TempVars vars = TempVars.get(); Vector3f vect1 = vars.vect1; Vector3f vect2 = vars.vect2; Triangle triangle = vars.triangle; Vector3f min = vect1.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); Vector3f max = vect2.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY); Vector3f point; for (int i = start; i < end; i++) { mesh.getTriangle(indices[i], triangle); point = triangle.get(0); checkMinMax(min, max, point); point = triangle.get(1); checkMinMax(min, max, point); point = triangle.get(2); checkMinMax(min, max, point); } center.set(min.addLocal(max)); center.multLocal(0.5f); xExtent = max.x - center.x; yExtent = max.y - center.y; zExtent = max.z - center.z; vars.release(); }
/** * <code>intersectWhere</code> determines if the Ray intersects a triangle. It then * stores the point of intersection in the given loc vector * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) * @return true if the ray collides. */ public boolean intersectWhere(Triangle t, Vector3f loc) { return intersectWhere(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>intersectWhere</code> determines if the Ray intersects a triangle. It then * stores the point of intersection in the given loc vector * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) * @return true if the ray collides. */ public boolean intersectWhere(Triangle t, Vector3f loc) { return intersectWhere(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>intersectWherePlanar</code> determines if the Ray intersects a * triangle and if so it stores the point of * intersection in the given loc vector as t, u, v where t is the distance * from the origin to the point of intersection and u,v is the intersection * point in terms of the triangle plane. * * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) as t, u, v * @return true if the ray collides. */ public boolean intersectWherePlanar(Triangle t, Vector3f loc) { return intersectWherePlanar(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>intersectWherePlanar</code> determines if the Ray intersects a * triangle and if so it stores the point of * intersection in the given loc vector as t, u, v where t is the distance * from the origin to the point of intersection and u,v is the intersection * point in terms of the triangle plane. * * @param t the Triangle to test against. * @param loc * storage vector to save the collision point in (if the ray * collides) as t, u, v * @return true if the ray collides. */ public boolean intersectWherePlanar(Triangle t, Vector3f loc) { return intersectWherePlanar(t.get(0), t.get(1), t.get(2), loc); }
/** * <code>computeFromTris</code> creates a new Bounding Box from a given * set of triangles. It is used in OBBTree calculations. * * @param tris * @param start * @param end */ public void computeFromTris(Triangle[] tris, int start, int end) { if (end - start <= 0) { return; } Vector3f[] vertList = new Vector3f[(end - start) * 3]; int count = 0; for (int i = start; i < end; i++) { vertList[count++] = tris[i].get(0); vertList[count++] = tris[i].get(1); vertList[count++] = tris[i].get(2); } averagePoints(vertList); } //
/** * <code>computeFromTris</code> creates a new Bounding Box from a given * set of triangles. It is used in OBBTree calculations. * * @param tris * @param start * @param end */ public void computeFromTris(Triangle[] tris, int start, int end) { if (end - start <= 0) { return; } Vector3f[] vertList = new Vector3f[(end - start) * 3]; int count = 0; for (int i = start; i < end; i++) { vertList[count++] = tris[i].get(0); vertList[count++] = tris[i].get(1); vertList[count++] = tris[i].get(2); } averagePoints(vertList); } //
t.get(0).x = (gridX); t.get(0).y = (h1); t.get(0).z = (gridY); t.get(1).x = (gridX); t.get(1).y = (h3); t.get(1).z = (gridY + 1); t.get(2).x = (gridX + 1); t.get(2).y = (h4); t.get(2).z = (gridY + 1); t2.get(0).x = (gridX); t2.get(0).y = (h1); t2.get(0).z = (gridY); t2.get(1).x = (gridX + 1); t2.get(1).y = (h4); t2.get(1).z = (gridY + 1); t2.get(2).x = (gridX + 1); t2.get(2).y = (h2); t2.get(2).z = (gridY); } else { t.get(0).x = (gridX); t.get(0).y = (h1); t.get(0).z = (gridY);
public void computeFromTris(int[] indices, Mesh mesh, int start, int end) { if (end - start <= 0) { return; } TempVars vars = TempVars.get(); Vector3f vect1 = vars.vect1; Vector3f vect2 = vars.vect2; Triangle triangle = vars.triangle; Vector3f min = vect1.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); Vector3f max = vect2.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY); Vector3f point; for (int i = start; i < end; i++) { mesh.getTriangle(indices[i], triangle); point = triangle.get(0); checkMinMax(min, max, point); point = triangle.get(1); checkMinMax(min, max, point); point = triangle.get(2); checkMinMax(min, max, point); } center.set(min.addLocal(max)); center.multLocal(0.5f); xExtent = max.x - center.x; yExtent = max.y - center.y; zExtent = max.z - center.z; vars.release(); }
public void computeFromTris(int[] indices, Mesh mesh, int start, int end) { if (end - start <= 0) { return; } TempVars vars = TempVars.get(); Vector3f vect1 = vars.vect1; Vector3f vect2 = vars.vect2; Triangle triangle = vars.triangle; Vector3f min = vect1.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); Vector3f max = vect2.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY); Vector3f point; for (int i = start; i < end; i++) { mesh.getTriangle(indices[i], triangle); point = triangle.get(0); checkMinMax(min, max, point); point = triangle.get(1); checkMinMax(min, max, point); point = triangle.get(2); checkMinMax(min, max, point); } center.set(min.addLocal(max)); center.multLocal(0.5f); xExtent = max.x - center.x; yExtent = max.y - center.y; zExtent = max.z - center.z; vars.release(); }