コード例 #1
0
ファイル: ShapeFactory.cs プロジェクト: wyb314/Physics2D.Net
 public static IShape CreateMultiPolygon(Vector2D[][] polygons, Scalar gridSpacing, ScalarColor4[][] colors)
 {
     if (polygons.Length == 1)
     {
         return(CreatePolygon(polygons[0], gridSpacing, colors[0]));
     }
     else
     {
         MultiPolygonShape shape = new MultiPolygonShape(polygons, gridSpacing);
         shape.Tag = DrawableFactory.CreateMultiPolygon(polygons, colors);
         return(shape);
     }
 }
コード例 #2
0
ファイル: ShapeFactory.cs プロジェクト: wyb314/Physics2D.Net
 public static IShape CreateColoredMultiPolygon(Vector2D[][] polygons, Scalar gridSpacing)
 {
     if (polygons.Length == 1)
     {
         return(CreateColoredPolygon(polygons[0], gridSpacing));
     }
     else
     {
         MultiPolygonShape shape   = new MultiPolygonShape(polygons, gridSpacing);
         ScalarColor3[][]  colors  = new ScalarColor3[polygons.Length][];
         Vector2D[][]      reduced = new Vector2D[polygons.Length][];
         for (int index = 0; index < polygons.Length; ++index)
         {
             reduced[index] = VertexHelper.Reduce(polygons[index]);
             colors[index]  = CreateColor3Array(reduced[index].Length);
         }
         shape.Tag = DrawableFactory.CreateMultiPolygon(reduced, colors);
         return(shape);
     }
 }