Skip to contents

generate_model() creates a building layout with multiple rooms arranged via recursive subdivision, including automatic placement of door between adjacent rooms, windows on exterior-facing rooms, and one entry door.

Usage

generate_model(
  n_room = 2,
  surface = 100,
  thickness_wall_ext = 0.25,
  thickness_wall_int = 0.1
)

Arguments

n_room

integer, number of rooms to generate (default: 2)

surface

numeric, total building floor area in square meters (default: 100)

thickness_wall_ext

numeric, thickness of exterior walls in meters (default: 0.25)

thickness_wall_int

numeric, thickness of interior walls in meters (default: 0.1)

Value

A list representing the building model:

  • exterior: Matrix of exterior polygon coordinates (x, y)

  • room_1, room_2, ..., room_n: Matrices of individual room coordinates

  • door: Named list of door objects, each containing coordinate (position), room (connected rooms), and optionally type ("entry")

  • window: Named list of window objects, each containing coordinate (position) and room (associated room)

Details

The function generates a building model through several steps:

  1. Exterior polygon: Creates a golden rectangle scaled to the desired area

  2. Interior subdivision: Recursively divides the interior space into n_room separate rooms using binary splitting

  3. Wall ID assignment: Assigns unique sequential IDs to all polygon edges

  4. Internal doors: Automatically places doors between adjacent room pairs by detecting shared wall segments

  5. Windows and entry: Places windows on all exterior-facing rooms, then converts the first exterior window into an entry door

Examples


# Generate a simple 3-room building
model = generate_model(n_room = 3, surface = 80, thickness_wall_ext = 0.3, thickness_wall_int = 0.1)

# Plot the model
plot_model_coordinate(model)


# Compute surface areas
compute_surface_model(model)
#> $summary
#> exterior.exterior          interior 
#>          80.00000          68.13768 
#> 
#> $detail
#> exterior   room_1   room_2   room_3 
#> 80.00000 16.90095 16.90095 34.33577 
#>