diff --git a/Engine.Physics2D/Primitives/Shape.cs b/Engine.Physics2D/Primitives/Shape.cs index 08570d2..dc9e2aa 100644 --- a/Engine.Physics2D/Primitives/Shape.cs +++ b/Engine.Physics2D/Primitives/Shape.cs @@ -11,6 +11,8 @@ public record Shape(IList Vertices) : IEnumerable { public Vector2D this[Index index] => Vertices[index]; + public static Shape CreateCopy(Shape shape) => new(new List(shape.Vertices)); + public static Triangle GetSuperTriangle(Shape shape) { float minX = float.MaxValue, minY = float.MaxValue; @@ -90,6 +92,7 @@ public record Shape(IList Vertices) : IEnumerable public static class ShapeExtensions { + public static Shape CreateCopy(Shape shape) => Shape.CreateCopy(shape); public static Triangle ToSuperTriangle(this Shape shape) => Shape.GetSuperTriangle(shape); public static void ToLines(this Shape shape, IList lines) => Shape.GetLines(shape, lines); public static List ToLines(this Shape shape) => Shape.GetLines(shape);