/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
/** * Normalize a Vector2 in-buffer. * * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector2(final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Normalize a Vector2 in-buffer. * * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector2(final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Multiply and store a Vector2 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector2 toMult, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Add to a Vector2 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector2 toAdd, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Add to a Vector2 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector2 toAdd, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Multiply and store a Vector2 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector2 toMult, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
final Vector2 pos = Vector2.fetchTempInstance().set(screenPosition); if (flipVertical) { pos.setY(getHeight() - screenPosition.getY());
final Vector2 pos = Vector2.fetchTempInstance().set(screenPosition); if (flipVertical) { pos.setY(getHeight() - screenPosition.getY());
final Vector2 x0x1 = Vector2.fetchTempInstance(); if (newComputeIntervals(vp0, vp1, vp2, dv0, dv1, dv2, dv0dv1, dv0dv2, abc, x0x1)) { return coplanarTriTri(n1, v0, v1, v2, u0, u1, u2); final Vector2 y0y1 = Vector2.fetchTempInstance(); if (newComputeIntervals(up0, up1, up2, du0, du1, du2, du0du1, du0du2, def, y0y1)) { return coplanarTriTri(n1, v0, v1, v2, u0, u1, u2);
final Vector2 x0x1 = Vector2.fetchTempInstance(); if (newComputeIntervals(vp0, vp1, vp2, dv0, dv1, dv2, dv0dv1, dv0dv2, abc, x0x1)) { return coplanarTriTri(n1, v0, v1, v2, u0, u1, u2); final Vector2 y0y1 = Vector2.fetchTempInstance(); if (newComputeIntervals(up0, up1, up2, du0, du1, du2, du0du1, du0du2, def, y0y1)) { return coplanarTriTri(n1, v0, v1, v2, u0, u1, u2);
meshData.setTextureBuffer(BufferUtils.createVector2Buffer(numParticles * verts), 0); final Vector2 temp = Vector2.fetchTempInstance(); for (int k = 0; k < numParticles; k++) { _particles[k] = new Particle(this);
meshData.setTextureBuffer(BufferUtils.createVector2Buffer(numParticles * verts), 0); final Vector2 temp = Vector2.fetchTempInstance(); for (int k = 0; k < numParticles; k++) { _particles[k] = new Particle(this);
@Test public void testValid() { final Vector2 vec1 = new Vector2(0, 0); final Vector2 vec2 = new Vector2(Double.POSITIVE_INFINITY, 0); final Vector2 vec3 = new Vector2(0, Double.NEGATIVE_INFINITY); final Vector2 vec4 = new Vector2(Double.NaN, 0); final Vector2 vec5 = new Vector2(0, Double.NaN); assertTrue(Vector2.isValid(vec1)); assertFalse(Vector2.isValid(vec2)); assertFalse(Vector2.isValid(vec3)); assertFalse(Vector2.isValid(vec4)); assertFalse(Vector2.isValid(vec5)); vec5.zero(); assertTrue(Vector2.isValid(vec5)); assertFalse(Vector2.isValid(null)); // couple of equals validity tests assertEquals(vec1, vec1); assertFalse(vec1.equals(null)); assertFalse(vec1.equals(new Vector3())); // throw in a couple pool accesses for coverage final Vector2 vec6 = Vector2.fetchTempInstance(); vec6.set(vec1); assertEquals(vec1, vec6); assertNotSame(vec1, vec6); Vector2.releaseTempInstance(vec6); // cover more of equals vec1.set(0, 1); assertFalse(vec1.equals(new Vector2(0, 2))); }