Class PointyTriOp<TCell>
Documentation in Op.cs
public class PointyTriOp<TCell> : AbstractOp<ShapeStorageInfo<PointyTriPoint>>
Type Parameters
TCell
- Inheritance
-
PointyTriOp<TCell>
- Inherited Members
- Extension Methods
Constructors
PointyTriOp()
public PointyTriOp()
PointyTriOp(ShapeStorageInfo<PointyTriPoint>, Func<ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>>)
public PointyTriOp(ShapeStorageInfo<PointyTriPoint> leftShapeInfo, Func<ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>> combineShapeInfo)
Parameters
leftShapeInfo
ShapeStorageInfo<PointyTriPoint>combineShapeInfo
Func<ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>, ShapeStorageInfo<PointyTriPoint>>
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 PointyTriShapeInfo<TCell> MyCustomShape(this PointyTriOp<TCell> op)
{
return
BeginGroup()
.Shape1()
.Union()
.Shape2()
.EndGroup(op);
}
Since version 1.1
public PointyTriOp<TCell> BeginGroup()
Returns
- PointyTriOp<TCell>
Default(int, int)
Creates the grid in a shape that spans the entire storage rectangle of the given width and height.
public PointyTriShapeInfo<TCell> Default(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>
FatRectangle(int, int)
public PointyTriShapeInfo<TCell> FatRectangle(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>
Hexagon(int)
public PointyTriShapeInfo<TCell> Hexagon(int side)
Parameters
side
int
Returns
- PointyTriShapeInfo<TCell>
LeftTriangle(int)
The origin is just to the left of the bottom corner.
public PointyTriShapeInfo<TCell> LeftTriangle(int side)
Parameters
side
int
Returns
- PointyTriShapeInfo<TCell>
ParallelogramXY(int, int)
[Version(1, 1, 0)]
public PointyTriShapeInfo<TCell> ParallelogramXY(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>
ParallelogramXZ(int, int)
Top corner is origin.
[Version(1, 1, 0)]
public PointyTriShapeInfo<TCell> ParallelogramXZ(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>
Rectangle(int, int)
public PointyTriShapeInfo<TCell> Rectangle(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>
RightTriangle(int)
public PointyTriShapeInfo<TCell> RightTriangle(int side)
Parameters
side
int
Returns
- PointyTriShapeInfo<TCell>
Shape(int, int, Func<PointyTriPoint, bool>)
The same as Shape with all parameters, but with bottomLeft Point set to PointyTriPoint.Zero.
public PointyTriShapeInfo<TCell> Shape(int width, int height, Func<PointyTriPoint, bool> isInside)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>
Returns
- PointyTriShapeInfo<TCell>
Shape(int, int, Func<PointyTriPoint, 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 PointyTriShapeInfo<TCell> MyShape()
{
Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public PointyTriShapeInfo<TCell> Shape(int width, int height, Func<PointyTriPoint, bool> isInside, FlatHexPoint bottomLeftCorner)
Parameters
width
intThe widh of the storage rectangle
height
intThe height of the storage rectangle
isInside
Func<PointyTriPoint, bool>A function that returns true if a passed point lies inside the shape being defined
bottomLeftCorner
FlatHexPointThe grid-space coordinate of the bottom left corner of the storage rect.
Returns
- PointyTriShapeInfo<TCell>
ShapeFromBase(FlatHexShapeInfo<TCell>)
public PointyTriShapeInfo<TCell> ShapeFromBase(FlatHexShapeInfo<TCell> baseShapeInfo)
Parameters
baseShapeInfo
FlatHexShapeInfo<TCell>
Returns
- PointyTriShapeInfo<TCell>
Single()
Makes a grid with a single cell that corresponds to the origin.
public PointyTriShapeInfo<TCell> Single()
Returns
- PointyTriShapeInfo<TCell>
SingleGroup()
public PointyTriShapeInfo<TCell> SingleGroup()
Returns
- PointyTriShapeInfo<TCell>
Star(int)
public PointyTriShapeInfo<TCell> Star(int side)
Parameters
side
int
Returns
- PointyTriShapeInfo<TCell>
ThinRectangle(int, int)
public PointyTriShapeInfo<TCell> ThinRectangle(int width, int height)
Parameters
Returns
- PointyTriShapeInfo<TCell>