Class FlatRhombOp<TCell>
Documentation in Op.cs
public class FlatRhombOp<TCell> : AbstractOp<ShapeStorageInfo<FlatRhombPoint>>
Type Parameters
TCell
- Inheritance
-
FlatRhombOp<TCell>
- Inherited Members
- Extension Methods
Constructors
FlatRhombOp()
public FlatRhombOp()
FlatRhombOp(ShapeStorageInfo<FlatRhombPoint>, Func<ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>>)
public FlatRhombOp(ShapeStorageInfo<FlatRhombPoint> leftShapeInfo, Func<ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>> combineShapeInfo)
Parameters
leftShapeInfoShapeStorageInfo<FlatRhombPoint>combineShapeInfoFunc<ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>, ShapeStorageInfo<FlatRhombPoint>>
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 FlatRhombShapeInfo<TCell> MyCustomShape(this FlatRhombOp<TCell> op)
{
return
BeginGroup()
.Shape1()
.Union()
.Shape2()
.EndGroup(op);
}
Since version 1.1
public FlatRhombOp<TCell> BeginGroup()
Returns
- FlatRhombOp<TCell>
Default(int, int)
Creates the grid in a shape that spans the entire storage rectangle of the given width and height.
public FlatRhombShapeInfo<TCell> Default(int width, int height)
Parameters
Returns
- FlatRhombShapeInfo<TCell>
FatRectangle(int, int)
public FlatRhombShapeInfo<TCell> FatRectangle(int width, int height)
Parameters
Returns
- FlatRhombShapeInfo<TCell>
Hexagon(int)
public FlatRhombShapeInfo<TCell> Hexagon(int side)
Parameters
sideint
Returns
- FlatRhombShapeInfo<TCell>
Parallelogram(int, int)
public FlatRhombShapeInfo<TCell> Parallelogram(int width, int height)
Parameters
Returns
- FlatRhombShapeInfo<TCell>
Rectangle(int, int)
public FlatRhombShapeInfo<TCell> Rectangle(int width, int height)
Parameters
Returns
- FlatRhombShapeInfo<TCell>
Shape(int, int, Func<FlatRhombPoint, bool>)
The same as Shape with all parameters, but with bottomLeft Point set to FlatRhombPoint.Zero.
public FlatRhombShapeInfo<TCell> Shape(int width, int height, Func<FlatRhombPoint, bool> isInside)
Parameters
widthintheightintisInsideFunc<FlatRhombPoint, bool>
Returns
- FlatRhombShapeInfo<TCell>
Shape(int, int, Func<FlatRhombPoint, bool>, FlatHexPoint)
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 FlatRhombShapeInfo<TCell> MyShape()
{
Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public FlatRhombShapeInfo<TCell> Shape(int width, int height, Func<FlatRhombPoint, bool> isInside, FlatHexPoint bottomLeftCorner)
Parameters
widthintThe widh of the storage rectangle
heightintThe height of the storage rectangle
isInsideFunc<FlatRhombPoint, bool>A function that returns true if a passed point lies inside the shape being defined
bottomLeftCornerFlatHexPointThe grid-space coordinate of the bottom left corner of the storage rect.
Returns
- FlatRhombShapeInfo<TCell>
ShapeFromBase(FlatHexShapeInfo<TCell>)
public FlatRhombShapeInfo<TCell> ShapeFromBase(FlatHexShapeInfo<TCell> baseShapeInfo)
Parameters
baseShapeInfoFlatHexShapeInfo<TCell>
Returns
- FlatRhombShapeInfo<TCell>
Single()
Makes a grid with a single cell that corresponds to the origin.
public FlatRhombShapeInfo<TCell> Single()
Returns
- FlatRhombShapeInfo<TCell>
SingleGroup()
public FlatRhombShapeInfo<TCell> SingleGroup()
Returns
- FlatRhombShapeInfo<TCell>
ThinRectangle(int, int)
public FlatRhombShapeInfo<TCell> ThinRectangle(int width, int height)
Parameters
Returns
- FlatRhombShapeInfo<TCell>