Class RectOp<TCell>
Documentation in Op.cs
public class RectOp<TCell> : AbstractOp<ShapeStorageInfo<RectPoint>>
Type Parameters
TCell
- Inheritance
-
RectOp<TCell>
- Inherited Members
- Extension Methods
Constructors
RectOp()
public RectOp()
RectOp(ShapeStorageInfo<RectPoint>, Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>>)
public RectOp(ShapeStorageInfo<RectPoint> leftShapeInfo, Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>> combineShapeInfo)
Parameters
leftShapeInfo
ShapeStorageInfo<RectPoint>combineShapeInfo
Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>>
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 RectShapeInfo<TCell> MyCustomShape(this RectOp<TCell> op)
{
return
BeginGroup()
.Shape1()
.Union()
.Shape2()
.EndGroup(op);
}
Since version 1.1
public RectOp<TCell> BeginGroup()
Returns
- RectOp<TCell>
CheckerBoard(int, int)
public RectShapeInfo<TCell> CheckerBoard(int width, int height)
Parameters
Returns
- RectShapeInfo<TCell>
CheckerBoard(int, int, bool)
public RectShapeInfo<TCell> CheckerBoard(int width, int height, bool includesOrigin)
Parameters
Returns
- RectShapeInfo<TCell>
Circle(int)
A rectangle centered at the given center, and with the given side length.
[Version(1, 9, 0)]
public RectShapeInfo<TCell> Circle(int radius)
Parameters
radius
int
Returns
- RectShapeInfo<TCell>
Default(int, int)
Creates the grid in a shape that spans the entire storage rectangle of the given width and height.
public RectShapeInfo<TCell> Default(int width, int height)
Parameters
Returns
- RectShapeInfo<TCell>
FixedHeight(int, int)
public RectShapeInfo<TCell> FixedHeight(int height, int cellCount)
Parameters
Returns
- RectShapeInfo<TCell>
FixedWidth(int, int)
XXXXX XXXXX XXX
public RectShapeInfo<TCell> FixedWidth(int width, int cellCount)
Parameters
Returns
- RectShapeInfo<TCell>
IsInsideCheckerBoard(RectPoint, int, int, bool)
public static bool IsInsideCheckerBoard(RectPoint point, int width, int height, bool includesOrigin)
Parameters
Returns
IsInsideFixedHeight(RectPoint, int, int)
public static bool IsInsideFixedHeight(RectPoint point, int height, int cellCount)
Parameters
Returns
IsInsideFixedWidth(RectPoint, int, int)
public static bool IsInsideFixedWidth(RectPoint point, int width, int cellCount)
Parameters
Returns
IsInsideRect(RectPoint, int, int)
public static bool IsInsideRect(RectPoint point, int width, int height)
Parameters
Returns
Parallelogram(int, int)
A synonym for Rectangle. Provided to support wrapped grids uniformly.
[Version(1, 7, 0)]
public RectShapeInfo<TCell> Parallelogram(int width, int height)
Parameters
Returns
- RectShapeInfo<TCell>
Rectangle(int, int)
Generates a grid in a rectangular shape.
public RectShapeInfo<TCell> Rectangle(int width, int height)
Parameters
Returns
- RectShapeInfo<TCell>
Shape(int, int, Func<RectPoint, bool>)
The same as Shape with all parameters, but with bottomLeft Point set to RectPoint.Zero.
public RectShapeInfo<TCell> Shape(int width, int height, Func<RectPoint, bool> isInside)
Parameters
Returns
- RectShapeInfo<TCell>
Shape(int, int, Func<RectPoint, bool>, RectPoint)
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 RectShapeInfo<TCell> MyShape()
{
Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public RectShapeInfo<TCell> Shape(int width, int height, Func<RectPoint, bool> isInside, RectPoint bottomLeftCorner)
Parameters
width
intThe widh of the storage rectangle
height
intThe height of the storage rectangle
isInside
Func<RectPoint, bool>A function that returns true if a passed point lies inside the shape being defined
bottomLeftCorner
RectPointThe grid-space coordinate of the bottom left corner of the storage rect.
Returns
- RectShapeInfo<TCell>
Single()
Makes a grid with a single cell that corresponds to the origin.
public RectShapeInfo<TCell> Single()
Returns
- RectShapeInfo<TCell>