feat: Useful Readonly Shapes
This commit is contained in:
parent
ceb29cc42f
commit
6a84c3ec1a
|
@ -8,6 +8,12 @@ namespace Syntriax.Engine.Physics2D.Primitives;
|
|||
|
||||
public record Shape(IList<Vector2D> Vertices) : IEnumerable<Vector2D>
|
||||
{
|
||||
public static readonly Shape Triangle = CreateNgon(3, Vector2D.Up);
|
||||
public static readonly Shape Box = CreateNgon(4, Vector2D.One);
|
||||
public static readonly Shape Pentagon = CreateNgon(5, Vector2D.Up);
|
||||
public static readonly Shape Hexagon = CreateNgon(6, Vector2D.Right);
|
||||
|
||||
|
||||
public Vector2D this[System.Index index] => Vertices[index];
|
||||
|
||||
public static Shape CreateCopy(Shape shape) => new(new List<Vector2D>(shape.Vertices));
|
||||
|
|
Loading…
Reference in New Issue