• API Documentation
Show / Hide Table of Contents
  • Rebus
    • Arguments
    • Biome
    • CantorPairing
    • CommandRequest
    • CommandResponse
    • CommandType
    • Commodity
    • Configuration
    • ConflictEventArgs
    • Depths
    • Economy
    • Fleet
    • HexPoint
    • IGameService
    • ILoginService
    • Player
    • Unit
    • User
    • Zone
    • ZoneInfo
  • Rebus.Client
    • GraphicsEngine
    • Layout
    • RpcClient
    • ZoneVisualizer
  • Rebus.Client.Lenses
    • BiomeLens
    • ConstellationLens
    • Lens
    • PopulationLens
    • StarLens
  • Rebus.Server
    • AStarSearch
    • EvaluationContext
    • FisherYatesShuffle
    • JuliaSet
    • PowerSet
  • Rebus.Server.Considerations
    • Agent
    • Behavior
    • BehaviorCollection
    • Consideration
    • ConsiderationCollection
    • FunctionConsideration
    • LinearConsideration
    • QuadraticConsideration
  • Rebus.Server.Functions
    • IFunctions<T>
  • System
    • NegativeExponentialRandom
  • System.Text.Json.Serialization.Converters
    • ComplexConverter
    • CultureInfoConverter
    • IPAddressConverter

Class Layout

Represents a grid of hexagons.

Inheritance
Object
Layout
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
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.

See Also

Red Blob Games - Hexagonal Grids
Amit Patel&apos;s Home Page
In This Article
Back to top © 2021-2022 Ishan Pranav. All rights reserved. Licensed under the MIT License.