DragInfo IExplosionAffectable.GetExplosionInfo(Matrix2x3 matrix, Scalar radius, GetTangentCallback callback)
        {
            Vector2D[] vertexes2 = new Vector2D[Vertexes.Length];
            for (int index = 0; index < vertexes2.Length; ++index)
            {
                vertexes2[index] = matrix * Vertexes[index];
            }
            Vector2D[] inter = ShapeHelper.GetIntersection(vertexes2, radius);
            if (inter.Length < 3)
            {
                return(null);
            }
            Vector2D centroid = PolygonShape.GetCentroid(inter);
            Vector2D tangent = callback(centroid);
            Scalar   min, max;

            ShapeHelper.GetProjectedBounds(inter, tangent, out min, out max);
            Scalar avg = (max + min) / 2;

            return(new DragInfo(tangent * avg, max - min));
        }
        public static FluidInfo GetFluidInfo(Vector2D[] vertexes2, GetTangentCallback callback, Line line)
        {
            Vector2D centroid;
            Scalar   area;
            Vector2D dragCenter;
            Scalar   dragArea;

            Vector2D[] vertexes = ShapeHelper.GetIntersection(vertexes2, line);
            if (vertexes.Length < 3)
            {
                return(null);
            }
            centroid = PolygonShape.GetCentroid(vertexes);
            area     = PolygonShape.GetArea(vertexes);
            Vector2D tangent = callback(centroid);
            Scalar   min, max;

            ShapeHelper.GetProjectedBounds(vertexes, tangent, out min, out max);
            Scalar avg = (max + min) / 2;

            dragCenter = tangent * avg;
            dragArea   = max - min;
            return(new FluidInfo(dragCenter, dragArea, centroid, area));
        }