start balcony
This commit is contained in:
@@ -3,6 +3,7 @@ from utils.Enums import COLLUMN_STYLE
|
||||
from gdpc import Editor, Block, geometry, Transform
|
||||
from buildings.geometry.Vertice import Vertice
|
||||
from buildings.elements.Window import Window
|
||||
from buildings.elements.Balcony import Balcony
|
||||
|
||||
class Facade:
|
||||
def __init__(self, rdata, vertices : list[Vertice], height : int, length : int, is_inner_or_outer : COLLUMN_STYLE):
|
||||
@@ -36,7 +37,12 @@ class Facade:
|
||||
|
||||
return Window(self.rdata["windows"] ,max_width, max_height)
|
||||
|
||||
def build_inter_floor(self, vertice : Vertice):
|
||||
def get_balcony(self) -> Balcony:
|
||||
len = rd.randint(self.rdata["balcony"]["size"]["min_len"], self.rdata["balcony"]["size"]["max_len"])
|
||||
max_width = self.length-2*self.padding
|
||||
return Balcony(len, max_width, self.window)
|
||||
|
||||
def build_inter_floor(self):
|
||||
if self.has_inter_floor:
|
||||
geometry.placeCuboid(self.editor,(0,self.height,-1),(self.length,self.height,-1),Block(self.materials[4], {"facing": "south", "half": "top"}))
|
||||
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import random as rd
|
||||
from buildings.elements.Window import Window
|
||||
|
||||
class Balcony:
|
||||
def __init__(self, length, width):
|
||||
def __init__(self, rdata, length : int, max_width : int, windows : Window):
|
||||
self.rdata = rdata
|
||||
self.length = length
|
||||
self.width = width
|
||||
self.max_width = max_width
|
||||
self.windows = windows
|
||||
|
||||
def has_multiple_balcony(self):
|
||||
if self.max_width < self.rdata["balcony"]["multiple"]["min_width"]: return False
|
||||
return self.rdata["balcony"]["multiple"]["proba"] >= rd.random()
|
||||
10
params.yml
10
params.yml
@@ -40,4 +40,12 @@ buildings:
|
||||
top: 1
|
||||
top_and_bottom: 1
|
||||
inter_floor: 0.5
|
||||
balcony: 0.25
|
||||
balcony:
|
||||
proba : 0.25
|
||||
size:
|
||||
min_len : 1
|
||||
max_len : 3
|
||||
min_width : 3
|
||||
multiple:
|
||||
min_width: 5
|
||||
proba: 0.5
|
||||
@@ -15,4 +15,4 @@ class COLLUMN_STYLE(Enum):
|
||||
class BORDER_RADIUS(Enum):
|
||||
NONE = 0
|
||||
TOP = 1
|
||||
TOP_AND_BOTTOM = 2
|
||||
TOP_AND_BOTTOM = 2
|
||||
Reference in New Issue
Block a user