Box2D.Collision.Collision.EPCollider.ComputePolygonSeparation C# (CSharp) Метод

ComputePolygonSeparation() приватный Метод

private ComputePolygonSeparation ( EPAxis axis ) : void
axis EPAxis
Результат void
            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;
                    }
                }
            }