
Generate coordinates for a model
generate_model.Rdgenerate_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
)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 coordinatesdoor: Named list of door objects, each containingcoordinate(position),room(connected rooms), and optionallytype("entry")window: Named list of window objects, each containingcoordinate(position) androom(associated room)
Details
The function generates a building model through several steps:
Exterior polygon: Creates a golden rectangle scaled to the desired area
Interior subdivision: Recursively divides the interior space into n_room separate rooms using binary splitting
Wall ID assignment: Assigns unique sequential IDs to all polygon edges
Internal doors: Automatically places doors between adjacent room pairs by detecting shared wall segments
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
#>