Class Layout
Represents a grid of hexagons.
Inherited Members
Namespace: Rebus.Client
Assembly: Rebus.Client.dll
Syntax
public class Layout
Remarks
The implementation of this class was inspired by and based on this article by Amit Patel.
Constructors
Layout(Single, Single)
Initializes a new instance of the Layout class.
Declaration
public Layout(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The x coordinate of the origin. |
Single | y | The y coordinate of the origin. |
Properties
HexagonHeight
Gets or sets the height factor of a hexagon.
Declaration
public float HexagonHeight { get; set; }
Property Value
Type | Description |
---|---|
Single | The height factor of a hexagon. |
HexagonWidth
Gets or sets the width factor of a hexagon.
Declaration
public float HexagonWidth { get; set; }
Property Value
Type | Description |
---|---|
Single | The width factor of a hexagon. |
X
Gets the x coordinate of the origin.
Declaration
public float X { get; }
Property Value
Type | Description |
---|---|
Single | The x coordinate of the origin. |
Y
Gets the y coordinate of the origin.
Declaration
public float Y { get; }
Property Value
Type | Description |
---|---|
Single | The y coordinate of the origin. |
Methods
GetCenter(HexPoint)
Gets the point representing the center of the hexagon at the given coordinate.
Declaration
public SKPoint GetCenter(HexPoint value)
Parameters
Type | Name | Description |
---|---|---|
HexPoint | value | The coordinate. |
Returns
Type | Description |
---|---|
SKPoint | The center of the hexagon. |
GetHexagon(HexPoint, Single)
Gets the path representing the hexagon at the given coordinate.
Declaration
public SKPath GetHexagon(HexPoint value, float scale)
Parameters
Type | Name | Description |
---|---|---|
HexPoint | value | The coordinate. |
Single | scale | The scale factor of the hexagon. |
Returns
Type | Description |
---|---|
SKPath | The hexagon. |
GetHexPoint(Single, Single)
Gets the hexagonal coordinate corresponding to the Cartesian coordinate.
Declaration
public HexPoint GetHexPoint(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The Cartesian x coordinate. |
Single | y | The Cartesian y coordinate. |
Returns
Type | Description |
---|---|
HexPoint | The hexagonal coordinate. |