Table of Contents

Method GetSpiralIterator

Namespace
Gamelogic.Grids2
Assembly
Gamelogic.Grids2.dll

GetSpiralIterator(IImplicitShape<GridPoint2>, GridPoint2, int)

Get's an enumerable of shape points in a square spiral outwards from a given point, assuming the points represents coordinates in a rect grid.

public static IEnumerable<GridPoint2> GetSpiralIterator(IImplicitShape<GridPoint2> shape, GridPoint2 origin, int ringCount)

Parameters

shape IImplicitShape<GridPoint2>

The shape to return points from.

origin GridPoint2

Where the spiral should start.

ringCount int

How many rings there should be in the spiral. The origin is the first ring, so when ringCount is 1, only the origin will be returned.

Returns

IEnumerable<GridPoint2>

Remarks

note

Remember that IExplicitShape<TPoint>, IGrid<TPoint, TCell> and Grid2<TCell> all are also of type IImplicitShape<TPoint>, so this method can be used with explicit shapes and grids too.