public virtual void computePolygonSeparation(EPAxis axis) { axis.type = EPAxis.Type.UNKNOWN; axis.index = -1; //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Float.MIN_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" axis.separation = Single.Epsilon; perp.set_Renamed(-m_normal.y, m_normal.x); for (int i = 0; i < m_polygonB.count; ++i) { n.set_Renamed(m_polygonB.normals[i]).negateLocal(); float s1 = Vec2.dot(n, temp.set_Renamed(m_polygonB.vertices[i]).subLocal(m_v1)); float s2 = Vec2.dot(n, temp.set_Renamed(m_polygonB.vertices[i]).subLocal(m_v2)); float s = MathUtils.min(s1, s2); if (s > m_radius) { // No collision axis.type = EPAxis.Type.EDGE_B; axis.index = i; axis.separation = s; return; } // Adjacency if (Vec2.dot(n, perp) >= 0.0f) { if (Vec2.dot(temp.set_Renamed(n).subLocal(m_upperLimit), m_normal) < -Settings.angularSlop) { continue; } } else { if (Vec2.dot(temp.set_Renamed(n).subLocal(m_lowerLimit), m_normal) < -Settings.angularSlop) { continue; } } if (s > axis.separation) { axis.type = EPAxis.Type.EDGE_B; axis.index = i; axis.separation = s; } } }
public virtual void computeEdgeSeparation(EPAxis axis) { axis.type = EPAxis.Type.EDGE_A; axis.index = m_front ? 0 : 1; axis.separation = System.Single.MaxValue; for (int i = 0; i < m_polygonB.count; ++i) { float s = Vec2.dot(m_normal, temp.set_Renamed(m_polygonB.vertices[i]).subLocal(m_v1)); if (s < axis.separation) { axis.separation = s; } } }
private void computePolygonSeparation(EPAxis axis) { axis.type = EPAxisType.UNKNOWN; axis.index = -1; axis.separation = -float.MaxValue; perp.x = -m_normal.y; perp.y = m_normal.x; for (int i = 0; i < m_polygonB.count; ++i) { Vec2 normalB = m_polygonB.normals[i]; Vec2 vB = m_polygonB.vertices[i]; n.x = -normalB.x; n.y = -normalB.y; // float s1 = Vec2.dot(n, temp.set(vB).subLocal(m_v1)); // float s2 = Vec2.dot(n, temp.set(vB).subLocal(m_v2)); float tempx = vB.x - m_v1.x; float tempy = vB.y - m_v1.y; float s1 = n.x*tempx + n.y*tempy; tempx = vB.x - m_v2.x; tempy = vB.y - m_v2.y; float s2 = n.x*tempx + n.y*tempy; float s = MathUtils.min(s1, s2); if (s > m_radius) { // No collision axis.type = EPAxisType.EDGE_B; axis.index = i; axis.separation = s; return; } // Adjacency if (n.x*perp.x + n.y*perp.y >= 0.0f) { temp.set(n); temp.subLocal(m_upperLimit); if (Vec2.dot(temp, m_normal) < -Settings.angularSlop) { continue; } } else { temp.set(n); temp.subLocal(m_lowerLimit); if (Vec2.dot(temp, m_normal) < -Settings.angularSlop) { continue; } } if (s > axis.separation) { axis.type = EPAxisType.EDGE_B; axis.index = i; axis.separation = s; } } }
private void computeEdgeSeparation(EPAxis axis) { axis.type = EPAxisType.EDGE_A; axis.index = m_front ? 0 : 1; axis.separation = float.MaxValue; float nx = m_normal.x; float ny = m_normal.y; for (int i = 0; i < m_polygonB.count; ++i) { Vec2 v = m_polygonB.vertices[i]; float tempx = v.x - m_v1.x; float tempy = v.y - m_v1.y; float s = nx*tempx + ny*tempy; if (s < axis.separation) { axis.separation = s; } } }
private void ComputePolygonSeparation(EPAxis axis) { axis.Type = EPAxis.EPAxisType.Unknown; axis.Index = -1; //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Float.MIN_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" axis.Separation = Single.Epsilon; perp.Set(-normal.Y, normal.X); for (int i = 0; i < polygonB.Count; ++i) { n.Set(polygonB.Normals[i]).NegateLocal(); float s1 = Vec2.Dot(n, temp.Set(polygonB.Vertices[i]).SubLocal(v1)); float s2 = Vec2.Dot(n, temp.Set(polygonB.Vertices[i]).SubLocal(v2)); float s = MathUtils.Min(s1, s2); if (s > radius) { // No collision axis.Type = EPAxis.EPAxisType.EdgeB; axis.Index = i; axis.Separation = s; return; } // Adjacency if (Vec2.Dot(n, perp) >= 0.0f) { if (Vec2.Dot(temp.Set(n).SubLocal(upperLimit), normal) < -Settings.ANGULAR_SLOP) { continue; } } else { if (Vec2.Dot(temp.Set(n).SubLocal(lowerLimit), normal) < -Settings.ANGULAR_SLOP) { continue; } } if (s > axis.Separation) { axis.Type = EPAxis.EPAxisType.EdgeB; axis.Index = i; axis.Separation = s; } } }
private void ComputeEdgeSeparation(EPAxis axis) { axis.Type = EPAxis.EPAxisType.EdgeA; axis.Index = front ? 0 : 1; axis.Separation = System.Single.MaxValue; for (int i = 0; i < polygonB.Count; ++i) { float s = Vec2.Dot(normal, temp.Set(polygonB.Vertices[i]).SubLocal(v1)); if (s < axis.Separation) { axis.Separation = s; } } }