Logo Hywe

Xyxel Module

Xyxel (XY Plane Layout Engine) Orchestrates collections of Coxels to resolve spatial distribution and boundary logic. Handles the horizontal "weaving" as the third stage in the hierarchy: Hexel-Coxel-Xyxel-Zaxel.

Types

Type Description

LayoutContext

Fully resolved layout context, ready for spatial execution.

LayoutOptions

Contextual parameters and overrides for layout generation.

LayoutTree

Represents the raw architectural tree with pre-calculated metrics to avoid redundant processing.

Functions and values

Function or value Description

applyReproportioning boundaryArea tree ratioOverride

Full Usage: applyReproportioning boundaryArea tree ratioOverride

Parameters:
    boundaryArea : int64 - Total available area of the boundary polygon in grid units.
    tree : LayoutTree - Raw architectural room tree.
    ratioOverride : float option - Optional scaling ratio override.

Returns: (Prp * Prp * Prp) array array * float Tuple of the scaled room tree (Refid, Count, Label)[][] and the final applied ratio.

Proportionally scales architectural room areas to fit within a bounded boundary polygon, preserving relative sizing.

boundaryArea : int64

Total available area of the boundary polygon in grid units.

tree : LayoutTree

Raw architectural room tree.

ratioOverride : float option

Optional scaling ratio override.

Returns: (Prp * Prp * Prp) array array * float

Tuple of the scaled room tree (Refid, Count, Label)[][] and the final applied ratio.

Example

 let raw = [| [| ("1", 40, "Living"); ("1.1", 20, "Kitchen") |] |]
 let tree = Xyxel.LayoutTree.Create raw
 let scaledTree, ratio = Xyxel.applyReproportioning 400L tree None
val raw: (string * int * string) array array
val tree: obj
val scaledTree: obj
val ratio: obj
union case Option.None: Option<'T>

calculateTargetRatio attrs tree opts

Full Usage: calculateTargetRatio attrs tree opts

Parameters:
    attrs : Map<string, string> - Map of attribute key-value pairs.
    tree : LayoutTree - Architectural layout tree.
    opts : LayoutOptions - Contextual options and overrides.

Returns: float Computed area scaling ratio float.

Calculates the ideal room area scaling ratio for a given layout configuration without preparing the full LayoutContext.

attrs : Map<string, string>

Map of attribute key-value pairs.

tree : LayoutTree

Architectural layout tree.

opts : LayoutOptions

Contextual options and overrides.

Returns: float

Computed area scaling ratio float.

Example

 let attrs = Map.ofList [ ("W", "20"); ("H", "20") ]
 let tree = Xyxel.LayoutTree.Create [| [| ("1", 20, "Room") |] |]
 let opts = { EntryFallback = "0,0"; InitialOcc = [||]; Seq = None; Width = Some 20; Height = Some 20; OuterStr = None; IslandsStr = None; ParentCxl = None; Ratio = None; Elevation = Some 0 }
 let ratio = Xyxel.calculateTargetRatio attrs tree opts
val attrs: Map<string,string>
Multiple items
module Map from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> = interface IReadOnlyDictionary<'Key,'Value> interface IReadOnlyCollection<KeyValuePair<'Key,'Value>> interface IEnumerable interface IStructuralEquatable interface IComparable interface IEnumerable<KeyValuePair<'Key,'Value>> interface ICollection<KeyValuePair<'Key,'Value>> interface IDictionary<'Key,'Value> new: elements: ('Key * 'Value) seq -> Map<'Key,'Value> member Add: key: 'Key * value: 'Value -> Map<'Key,'Value> ...

--------------------
new: elements: ('Key * 'Value) seq -> Map<'Key,'Value>
val ofList: elements: ('Key * 'T) list -> Map<'Key,'T> (requires comparison)
val tree: obj
val opts: 'a
module Seq from Microsoft.FSharp.Collections
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val ratio: obj

generateBaseCxl ctx

Full Usage: generateBaseCxl ctx

Parameters:
Returns: (Cxl * Hxl array) option Option containing a tuple of the root Coxel and the updated occupied hexels.

Extracts the root node from the LayoutContext, establishes boundary obstacle hexels, and generates the initial base Coxel.

ctx : LayoutContext

Resolved layout context.

Returns: (Cxl * Hxl array) option

Option containing a tuple of the root Coxel and the updated occupied hexels.

Example

 match Xyxel.generateBaseCxl ctx with
 | Some (rootCxl, occ) -> ()
 | None -> ()
union case Option.Some: Value: 'T -> Option<'T>
val rootCxl: obj
val occ: obj
union case Option.None: Option<'T>

generateCxlLayout ctx rootCxl nextOcc

Full Usage: generateCxlLayout ctx rootCxl nextOcc

Parameters:
    ctx : LayoutContext - Resolved layout context.
    rootCxl : Cxl - Root base Coxel.
    nextOcc : Hxl[] - Occupied hexel coordinates including boundaries and previous rooms.

Returns: Cxl[] * (int * int)[][] * float Tuple of generated Coxel array, boundary polygon vertex arrays, and applied scaling ratio.

Executes spatial construction for a single level, growing child Coxels recursively from the root Coxel according to the architectural tree.

ctx : LayoutContext

Resolved layout context.

rootCxl : Cxl

Root base Coxel.

nextOcc : Hxl[]

Occupied hexel coordinates including boundaries and previous rooms.

Returns: Cxl[] * (int * int)[][] * float

Tuple of generated Coxel array, boundary polygon vertex arrays, and applied scaling ratio.

Example

 match Xyxel.generateBaseCxl ctx with
 | Some (rootCxl, occ) ->
     let rooms, bounds, ratio = Xyxel.generateCxlLayout ctx rootCxl occ
 | None -> ()
union case Option.Some: Value: 'T -> Option<'T>
val rootCxl: obj
val occ: obj
val rooms: obj
val bounds: obj
val ratio: obj
union case Option.None: Option<'T>

prepareLayoutContext attrs tree opts

Full Usage: prepareLayoutContext attrs tree opts

Parameters:
    attrs : Map<string, string> - Map of attribute key-value pairs (e.g. "Q", "L", "W", "H", "O", "I").
    tree : LayoutTree - Architectural layout tree.
    opts : LayoutOptions - Contextual options and overrides.

Returns: LayoutContext A fully resolved LayoutContext ready for generation.

Resolves all attributes, parses boundary geometries, and calculates scaling ratios into a LayoutContext ready for layout execution.

attrs : Map<string, string>

Map of attribute key-value pairs (e.g. "Q", "L", "W", "H", "O", "I").

tree : LayoutTree

Architectural layout tree.

opts : LayoutOptions

Contextual options and overrides.

Returns: LayoutContext

A fully resolved LayoutContext ready for generation.

Example

 let attrs = Map.ofList [ ("Q", "VRCWEE"); ("W", "30"); ("H", "30") ]
 let raw = [| [| ("1", 30, "Living"); ("1.1", 15, "Kitchen") |] |]
 let tree = Xyxel.LayoutTree.Create raw
 let opts = { EntryFallback = "0,0"; InitialOcc = [||]; Seq = None; Width = Some 30; Height = Some 30; OuterStr = None; IslandsStr = None; ParentCxl = None; Ratio = None; Elevation = Some 0 }
 let ctx = Xyxel.prepareLayoutContext attrs tree opts
val attrs: Map<string,string>
Multiple items
module Map from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> = interface IReadOnlyDictionary<'Key,'Value> interface IReadOnlyCollection<KeyValuePair<'Key,'Value>> interface IEnumerable interface IStructuralEquatable interface IComparable interface IEnumerable<KeyValuePair<'Key,'Value>> interface ICollection<KeyValuePair<'Key,'Value>> interface IDictionary<'Key,'Value> new: elements: ('Key * 'Value) seq -> Map<'Key,'Value> member Add: key: 'Key * value: 'Value -> Map<'Key,'Value> ...

--------------------
new: elements: ('Key * 'Value) seq -> Map<'Key,'Value>
val ofList: elements: ('Key * 'T) list -> Map<'Key,'T> (requires comparison)
val raw: (string * int * string) array array
val tree: obj
val opts: 'a
module Seq from Microsoft.FSharp.Collections
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val ctx: obj

tryParseUnion s

Full Usage: tryParseUnion s

Parameters:
    s : string - String representation of the case name.

Returns: 'T option Some case value if matched; otherwise None.
Type parameters: 'T

Attempts to parse a string value into an F# discriminated union case value by name (case-insensitive).

s : string

String representation of the case name.

Returns: 'T option

Some case value if matched; otherwise None.

Example

 let sqnOpt = Xyxel.tryParseUnion<Hexel.Sqn> "VRCWEE"
val sqnOpt: obj

Type something to start searching.