Class PointyRhombOp<TCell>
Documentation in Op.cs
public class PointyRhombOp<TCell> : AbstractOp<ShapeStorageInfo<PointyRhombPoint>>
Type Parameters
TCell
- Inheritance
-
PointyRhombOp<TCell>
- Inherited Members
- Extension Methods
Constructors
PointyRhombOp()
public PointyRhombOp()
PointyRhombOp(ShapeStorageInfo<PointyRhombPoint>, Func<ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>>)
public PointyRhombOp(ShapeStorageInfo<PointyRhombPoint> leftShapeInfo, Func<ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>> combineShapeInfo)
Parameters
leftShapeInfo
ShapeStorageInfo<PointyRhombPoint>combineShapeInfo
Func<ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>, ShapeStorageInfo<PointyRhombPoint>>
Methods
BeginGroup()
Starts a compound shape operation.
Any shape that is defined in terms of other shape operations must use this method, and use Endgroup() to end the definition.
public static PointyRhombShapeInfo<TCell> MyCustomShape(this PointyRhombOp<TCell> op)
{
return
BeginGroup()
.Shape1()
.Union()
.Shape2()
.EndGroup(op);
}
Since version 1.1
public PointyRhombOp<TCell> BeginGroup()
Returns
- PointyRhombOp<TCell>
Default(int, int)
Creates the grid in a shape that spans the entire storage rectangle of the given width and height.
public PointyRhombShapeInfo<TCell> Default(int width, int height)
Parameters
Returns
- PointyRhombShapeInfo<TCell>
Diamond(int)
public PointyRhombShapeInfo<TCell> Diamond(int side)
Parameters
side
int
Returns
- PointyRhombShapeInfo<TCell>
DownTriangle(int)
public PointyRhombShapeInfo<TCell> DownTriangle(int side)
Parameters
side
int
Returns
- PointyRhombShapeInfo<TCell>
FatRectangle(int, int)
public PointyRhombShapeInfo<TCell> FatRectangle(int width, int height)
Parameters
Returns
- PointyRhombShapeInfo<TCell>
Hexagon(int)
public PointyRhombShapeInfo<TCell> Hexagon(int side)
Parameters
side
int
Returns
- PointyRhombShapeInfo<TCell>
Parallelogram(int, int)
public PointyRhombShapeInfo<TCell> Parallelogram(int width, int height)
Parameters
Returns
- PointyRhombShapeInfo<TCell>
Rectangle(int, int)
public PointyRhombShapeInfo<TCell> Rectangle(int width, int height)
Parameters
Returns
- PointyRhombShapeInfo<TCell>
Shape(int, int, Func<PointyRhombPoint, bool>)
The same as Shape with all parameters, but with bottomLeft Point set to PointyRhombPoint.Zero.
public PointyRhombShapeInfo<TCell> Shape(int width, int height, Func<PointyRhombPoint, bool> isInside)
Parameters
width
intheight
intisInside
Func<PointyRhombPoint, bool>
Returns
- PointyRhombShapeInfo<TCell>
Shape(int, int, Func<PointyRhombPoint, bool>, PointyHexPoint)
Use this function to create shapes to ensure they fit into memory.
The test function can test shapes anywhere in space.If you specify the bottom corner (in terms of the storage rectangle), the shape is automatically translated in memory to fit, assuming memory width and height is big enough.
Strategy for implementing new shapes: - First, determine the test function. - Next, draw a storage rectangle that contains the shape. - Determine the storgae rectangle width and height. - Finally, determine the grid-space coordinate of the left bottom corner of the storage rectangle.
Then define your function as follows:
public PointyRhombShapeInfo<TCell> MyShape()
{
Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public PointyRhombShapeInfo<TCell> Shape(int width, int height, Func<PointyRhombPoint, bool> isInside, PointyHexPoint bottomLeftCorner)
Parameters
width
intThe widh of the storage rectangle
height
intThe height of the storage rectangle
isInside
Func<PointyRhombPoint, bool>A function that returns true if a passed point lies inside the shape being defined
bottomLeftCorner
PointyHexPointThe grid-space coordinate of the bottom left corner of the storage rect.
Returns
- PointyRhombShapeInfo<TCell>
ShapeFromBase(PointyHexShapeInfo<TCell>)
public PointyRhombShapeInfo<TCell> ShapeFromBase(PointyHexShapeInfo<TCell> baseShapeInfo)
Parameters
baseShapeInfo
PointyHexShapeInfo<TCell>
Returns
- PointyRhombShapeInfo<TCell>
Single()
Makes a grid with a single cell that corresponds to the origin.
public PointyRhombShapeInfo<TCell> Single()
Returns
- PointyRhombShapeInfo<TCell>
SingleGroup()
public PointyRhombShapeInfo<TCell> SingleGroup()
Returns
- PointyRhombShapeInfo<TCell>
ThinRectangle(int, int)
public PointyRhombShapeInfo<TCell> ThinRectangle(int width, int height)
Parameters
Returns
- PointyRhombShapeInfo<TCell>
UpTriangle(int)
public PointyRhombShapeInfo<TCell> UpTriangle(int side)
Parameters
side
int
Returns
- PointyRhombShapeInfo<TCell>