Class FlatTriOp<TCell>
Documentation in Op.cs
public class FlatTriOp<TCell> : AbstractOp<ShapeStorageInfo<FlatTriPoint>>
Type Parameters
TCell
- Inheritance
-
FlatTriOp<TCell>
- Inherited Members
- Extension Methods
Constructors
FlatTriOp()
public FlatTriOp()
FlatTriOp(ShapeStorageInfo<FlatTriPoint>, Func<ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>>)
public FlatTriOp(ShapeStorageInfo<FlatTriPoint> leftShapeInfo, Func<ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>> combineShapeInfo)
Parameters
leftShapeInfo
ShapeStorageInfo<FlatTriPoint>combineShapeInfo
Func<ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>, ShapeStorageInfo<FlatTriPoint>>
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 FlatTriShapeInfo<TCell> MyCustomShape(this FlatTriOp<TCell> op)
{
return
BeginGroup()
.Shape1()
.Union()
.Shape2()
.EndGroup(op);
}
Since version 1.1
public FlatTriOp<TCell> BeginGroup()
Returns
- FlatTriOp<TCell>
Default(int, int)
Creates the grid in a shape that spans the entire storage rectangle of the given width and height.
public FlatTriShapeInfo<TCell> Default(int width, int height)
Parameters
Returns
- FlatTriShapeInfo<TCell>
DownTriangle(int)
public FlatTriShapeInfo<TCell> DownTriangle(int side)
Parameters
side
int
Returns
- FlatTriShapeInfo<TCell>
Hexagon(int)
public FlatTriShapeInfo<TCell> Hexagon(int side)
Parameters
side
int
Returns
- FlatTriShapeInfo<TCell>
ParallelogramXY(int, int)
[Version(1, 1, 0)]
public FlatTriShapeInfo<TCell> ParallelogramXY(int width, int height)
Parameters
Returns
- FlatTriShapeInfo<TCell>
ParallelogramXZ(int, int)
Top corner is origin.
[Version(1, 1, 0)]
public FlatTriShapeInfo<TCell> ParallelogramXZ(int width, int height)
Parameters
Returns
- FlatTriShapeInfo<TCell>
Rectangle(int, int)
public FlatTriShapeInfo<TCell> Rectangle(int width, int height)
Parameters
Returns
- FlatTriShapeInfo<TCell>
Shape(int, int, Func<FlatTriPoint, bool>)
The same as Shape with all parameters, but with bottomLeft Point set to FlatTriPoint.Zero.
public FlatTriShapeInfo<TCell> Shape(int width, int height, Func<FlatTriPoint, bool> isInside)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>
Returns
- FlatTriShapeInfo<TCell>
Shape(int, int, Func<FlatTriPoint, 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 FlatTriShapeInfo<TCell> MyShape()
{
Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public FlatTriShapeInfo<TCell> Shape(int width, int height, Func<FlatTriPoint, bool> isInside, PointyHexPoint bottomLeftCorner)
Parameters
width
intThe widh of the storage rectangle
height
intThe height of the storage rectangle
isInside
Func<FlatTriPoint, 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
- FlatTriShapeInfo<TCell>
ShapeFromBase(PointyHexShapeInfo<TCell>)
public FlatTriShapeInfo<TCell> ShapeFromBase(PointyHexShapeInfo<TCell> baseShapeInfo)
Parameters
baseShapeInfo
PointyHexShapeInfo<TCell>
Returns
- FlatTriShapeInfo<TCell>
Single()
Makes a grid with a single cell that corresponds to the origin.
public FlatTriShapeInfo<TCell> Single()
Returns
- FlatTriShapeInfo<TCell>
SingleGroup()
public FlatTriShapeInfo<TCell> SingleGroup()
Returns
- FlatTriShapeInfo<TCell>
Star(int)
public FlatTriShapeInfo<TCell> Star(int side)
Parameters
side
int
Returns
- FlatTriShapeInfo<TCell>
UpTriangle(int)
public FlatTriShapeInfo<TCell> UpTriangle(int side)
Parameters
side
int
Returns
- FlatTriShapeInfo<TCell>