public final static float distance(Vec2 v1, Vec2 v2) { return sqrt(distanceSquared(v1, v2)); } }
/** * Create a chain with isolated end vertices. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createChain(final Vec2 vertices[], int count) { assert (m_vertices == null && m_count == 0); assert (count >= 2); m_count = count; m_vertices = new Vec2[m_count]; for (int i = 1; i < m_count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < m_count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_hasPrevVertex = false; m_hasNextVertex = false; m_prevVertex.setZero(); m_nextVertex.setZero(); }
/** * Create a loop. This automatically adjusts connectivity. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createLoop(final Vec2[] vertices, int count) { assert (m_vertices == null && m_count == 0); assert (count >= 3); m_count = count + 1; m_vertices = new Vec2[m_count]; for (int i = 1; i < count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_vertices[count] = new Vec2(m_vertices[0]); m_prevVertex.set(m_vertices[m_count - 2]); m_nextVertex.set(m_vertices[1]); m_hasPrevVertex = true; m_hasNextVertex = true; }
pointB.y = (xfB.q.s * mp0p.x + xfB.q.c * mp0p.y) + xfB.p.y; if (MathUtils.distanceSquared(pointA, pointB) > Settings.EPSILON * Settings.EPSILON) { normal.x = pointB.x - pointA.x; normal.y = pointB.y - pointA.y;
public final static float distance(Vec2 v1, Vec2 v2) { return sqrt(distanceSquared(v1, v2)); } }
boolean unique = true; for (int j = 0; j < tempCount; ++j) { if (MathUtils.distanceSquared(v, ps[j]) < 0.5f * Settings.linearSlop) { unique = false; break;
/** * Create a chain with isolated end vertices. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createChain(final Vec2 vertices[], int count) { assert (m_vertices == null && m_count == 0); assert (count >= 2); m_count = count; m_vertices = new Vec2[m_count]; for (int i = 1; i < m_count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < m_count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_hasPrevVertex = false; m_hasNextVertex = false; m_prevVertex.setZero(); m_nextVertex.setZero(); }
/** * Create a loop. This automatically adjusts connectivity. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createLoop(final Vec2[] vertices, int count) { assert (m_vertices == null && m_count == 0); assert (count >= 3); m_count = count + 1; m_vertices = new Vec2[m_count]; for (int i = 1; i < count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_vertices[count] = new Vec2(m_vertices[0]); m_prevVertex.set(m_vertices[m_count - 2]); m_nextVertex.set(m_vertices[1]); m_hasPrevVertex = true; m_hasNextVertex = true; }
pointB.y = (xfB.q.s * mp0p.x + xfB.q.c * mp0p.y) + xfB.p.y; if (MathUtils.distanceSquared(pointA, pointB) > Settings.EPSILON * Settings.EPSILON) { normal.x = pointB.x - pointA.x; normal.y = pointB.y - pointA.y;
public final static float distance(Vec2 v1, Vec2 v2) { return sqrt(distanceSquared(v1, v2)); } }
public final static float distance(Vec2 v1, Vec2 v2) { return sqrt(distanceSquared(v1, v2)); } }
/** * Create a chain with isolated end vertices. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createChain(final Vec2 vertices[], int count) { assert (m_vertices == null && m_count == 0); assert (count >= 2); m_count = count; m_vertices = new Vec2[m_count]; for (int i = 1; i < m_count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < m_count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_hasPrevVertex = false; m_hasNextVertex = false; }
boolean unique = true; for (int j = 0; j < tempCount; ++j) { if (MathUtils.distanceSquared(v, ps[j]) < 0.5f * Settings.linearSlop) { unique = false; break;
/** * Create a chain with isolated end vertices. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createChain(final Vec2 vertices[], int count) { assert (m_vertices == null && m_count == 0); assert (count >= 2); m_count = count; m_vertices = new Vec2[m_count]; for (int i = 1; i < m_count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < m_count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_hasPrevVertex = false; m_hasNextVertex = false; m_prevVertex.setZero(); m_nextVertex.setZero(); }
/** * Create a loop. This automatically adjusts connectivity. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createLoop(final Vec2[] vertices, int count) { assert (m_vertices == null && m_count == 0); assert (count >= 3); m_count = count + 1; m_vertices = new Vec2[m_count]; for (int i = 1; i < count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_vertices[count] = new Vec2(m_vertices[0]); m_prevVertex.set(m_vertices[m_count - 2]); m_nextVertex.set(m_vertices[1]); m_hasPrevVertex = true; m_hasNextVertex = true; }
/** * Create a loop. This automatically adjusts connectivity. * * @param vertices an array of vertices, these are copied * @param count the vertex count */ public void createLoop(final Vec2[] vertices, int count) { assert (m_vertices == null && m_count == 0); assert (count >= 3); m_count = count + 1; m_vertices = new Vec2[m_count]; for (int i = 1; i < count; i++) { Vec2 v1 = vertices[i - 1]; Vec2 v2 = vertices[i]; // If the code crashes here, it means your vertices are too close together. if (MathUtils.distanceSquared(v1, v2) < Settings.linearSlop * Settings.linearSlop) { throw new RuntimeException("Vertices of chain shape are too close together"); } } for (int i = 0; i < count; i++) { m_vertices[i] = new Vec2(vertices[i]); } m_vertices[count] = new Vec2(m_vertices[0]); m_prevVertex.set(m_vertices[m_count - 2]); m_nextVertex.set(m_vertices[1]); m_hasPrevVertex = true; m_hasNextVertex = true; }
pointB.y = (xfB.q.s * mp0p.x + xfB.q.c * mp0p.y) + xfB.p.y; if (MathUtils.distanceSquared(pointA, pointB) > Settings.EPSILON * Settings.EPSILON) { normal.x = pointB.x - pointA.x; normal.y = pointB.y - pointA.y;
Transform.mulToOut(xfB, manifold.points[0].localPoint, pointB); if (MathUtils.distanceSquared(pointA, pointB) > Settings.EPSILON * Settings.EPSILON) { normal.x = pointB.x - pointA.x; normal.y = pointB.y - pointA.y;
boolean unique = true; for (int j = 0; j < tempCount; ++j) { if (MathUtils.distanceSquared(v, ps[j]) < 0.5f * Settings.linearSlop) { unique = false; break;