public void writeCache(SimplexCache cache) { cache.metric = getMetric(); cache.count = m_count; for (int i = 0; i < m_count; ++i) { cache.indexA[i] = (vertices[i].indexA); cache.indexB[i] = (vertices[i].indexB); } }
public EPCollider() { for (int i = 0; i < 2; i++) { ie[i] = new ClipVertex(); clipPoints1[i] = new ClipVertex(); clipPoints2[i] = new ClipVertex(); } }
public DefaultWorldPool(int argSize, int argContainerSize) { vecs = new OrderedStack<Vec2>(argSize, argContainerSize) { protected Vec2 newInstance() { return new Vec2(); } }; vec3s = new OrderedStack<Vec3>(argSize, argContainerSize) { protected Vec3 newInstance() { return new Vec3(); } }; mats = new OrderedStack<Mat22>(argSize, argContainerSize) { protected Mat22 newInstance() { return new Mat22(); } }; aabbs = new OrderedStack<AABB>(argSize, argContainerSize) { protected AABB newInstance() { return new AABB(); } }; rots = new OrderedStack<Rot>(argSize, argContainerSize) { protected Rot newInstance() { return new Rot(); } }; mat33s = new OrderedStack<Mat33>(argSize, argContainerSize) { protected Mat33 newInstance() { return new Mat33(); } }; dist = new Distance(); collision = new Collision(this); toi = new TimeOfImpact(this); }
protected AABB newInstance() { return new AABB(); } };
/** * Blank manifold point with everything zeroed out. */ public ManifoldPoint() { localPoint = new Vec2(); normalImpulse = tangentImpulse = 0f; id = new ContactID(); }
/** * @deprecated please use {@link #raycast(RayCastOutput, RayCastInput, IWorldPool)} for better * performance * @param output * @param input * @return */ public final boolean raycast(final RayCastOutput output, final RayCastInput input) { return raycast(output, input, new DefaultWorldPool(4, 4)); }
public ContactID(final ContactID c) { set(c); }
@Override public float getAreaRatio() { if (m_root == NULL_NODE) { return 0.0f; } final int root = m_root; float rootArea = m_aabb[root].getPerimeter(); float totalArea = 0.0f; for (int i = 0; i < m_nodeCapacity; ++i) { if (m_height[i] < 0) { // Free node in pool continue; } totalArea += m_aabb[i].getPerimeter(); } return totalArea / rootArea; }
public void collideEdgeAndPolygon(Manifold manifold, final EdgeShape edgeA, final Transform xfA, final PolygonShape polygonB, final Transform xfB) { collider.collide(manifold, edgeA, xfA, polygonB, xfB); }
/** * creates a manifold with 0 points, with it's points array full of instantiated ManifoldPoints. */ public Manifold() { points = new ManifoldPoint[Settings.maxManifoldPoints]; for (int i = 0; i < Settings.maxManifoldPoints; i++) { points[i] = new ManifoldPoint(); } localNormal = new Vec2(); localPoint = new Vec2(); pointCount = 0; }
protected Contact(IWorldPool argPool) { m_fixtureA = null; m_fixtureB = null; m_nodeA = new ContactEdge(); m_nodeB = new ContactEdge(); m_manifold = new Manifold(); pool = argPool; }
/** * copies this manifold from the given one * * @param cp manifold to copy from */ public void set(Manifold cp) { for (int i = 0; i < cp.pointCount; i++) { points[i].set(cp.points[i]); } type = cp.type; localNormal.set(cp.localNormal); localPoint.set(cp.localPoint); pointCount = cp.pointCount; } }
/** * Creates a manifold point as a copy of the given point * @param cp point to copy from */ public ManifoldPoint(final ManifoldPoint cp) { localPoint = cp.localPoint.clone(); normalImpulse = cp.normalImpulse; tangentImpulse = cp.tangentImpulse; id = new ContactID(cp.id); }
public Collision(IWorldPool argPool) { incidentEdge[0] = new ClipVertex(); incidentEdge[1] = new ClipVertex(); clipPoints1[0] = new ClipVertex(); clipPoints1[1] = new ClipVertex(); clipPoints2[0] = new ClipVertex(); clipPoints2[1] = new ClipVertex(); pool = argPool; }
/** * Sets this manifold point form the given one * @param cp the point to copy from */ public void set(final ManifoldPoint cp){ localPoint.set(cp.localPoint); normalImpulse = cp.normalImpulse; tangentImpulse = cp.tangentImpulse; id.set(cp.id); } }
@Override public float getAreaRatio() { if (m_root == null) { return 0.0f; } final DynamicTreeNode root = m_root; float rootArea = root.aabb.getPerimeter(); float totalArea = 0.0f; for (int i = 0; i < m_nodeCapacity; ++i) { final DynamicTreeNode node = m_nodes[i]; if (node.height < 0) { // Free node in pool continue; } totalArea += node.aabb.getPerimeter(); } return totalArea / rootArea; }
public ManifoldPoint[] getPoints () { for (int i = 0; i < manifold.points.length; i++) { points[i].contactID = manifold.points[i].id.getKey(); points[i].localPoint.set(manifold.points[i].localPoint.x, manifold.points[i].localPoint.y); points[i].normalImpulse = manifold.points[i].normalImpulse; points[i].tangentImpulse = manifold.points[i].tangentImpulse; } return points; }
public ClipVertex() { v = new Vec2(); id = new ContactID(); }