Box2D.Collision.Distance.DistanceProxy.GetSupportVertex C# (CSharp) Method

GetSupportVertex() public method

Get the supporting vertex in the given direction.
public GetSupportVertex ( Vec2 d ) : Vec2
d Box2D.Common.Vec2
return Box2D.Common.Vec2
            public Vec2 GetSupportVertex(Vec2 d)
            {
                int bestIndex = 0;
                float bestValue = Vec2.Dot(Vertices[0], d);
                for (int i = 1; i < VertexCount; i++)
                {
                    float value = Vec2.Dot(Vertices[i], d);
                    if (value > bestValue)
                    {
                        bestIndex = i;
                        bestValue = value;
                    }
                }

                return Vertices[bestIndex];
            }