feat: Useful Readonly Shapes
This commit is contained in:
		@@ -8,6 +8,12 @@ namespace Syntriax.Engine.Physics2D.Primitives;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public record Shape(IList<Vector2D> Vertices) : IEnumerable<Vector2D>
 | 
					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 Vector2D this[System.Index index] => Vertices[index];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static Shape CreateCopy(Shape shape) => new(new List<Vector2D>(shape.Vertices));
 | 
					    public static Shape CreateCopy(Shape shape) => new(new List<Vector2D>(shape.Vertices));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user