FluidInfo ILineFluidAffectable.GetFluidInfo(GetTangentCallback callback, Line line) { if (polygons.Length == 1) { return(ShapeHelper.GetFluidInfo(Vertexes, callback, line)); } List <Vector2D[]> submerged = new List <Vector2D[]>(polygons.Length); for (int index = 0; index < polygons.Length; ++index) { Vector2D[] vertexes = VertexHelper.GetIntersection(polygons[index], line); if (vertexes.Length >= 3) { submerged.Add(vertexes); } } if (submerged.Count == 0) { return(null); } Vector2D[][] newPolygons = submerged.ToArray(); Vector2D centroid = VertexHelper.GetCentroidOfRange(newPolygons); Scalar area = VertexHelper.GetAreaOfRange(newPolygons); Vector2D tangent = callback(centroid); Vector2D dragCenter; Scalar dragArea; ShapeHelper.GetFluidInfo(newPolygons, tangent, out dragCenter, out dragArea); return(new FluidInfo(dragCenter, dragArea, centroid, area)); }
DragInfo IGlobalFluidAffectable.GetFluidInfo(Vector2D tangent) { Vector2D dragCenter; Scalar dragArea; ShapeHelper.GetFluidInfo(polygons, tangent, out dragCenter, out dragArea); return(new DragInfo(dragCenter, dragArea)); }
FluidInfo ILineFluidAffectable.GetFluidInfo(GetTangentCallback callback, Line line) { return(ShapeHelper.GetFluidInfo(Vertexes, callback, line)); }