city_retrofit/city_model_structure/building_demand/help.py
2021-08-27 17:29:32 -04:00

27 lines
962 B
Python

# from surfaces to thermal_zones
#zone_surfaces = []
# these should be the virtual internal surfaces (What about the internal walls??)
#for surface_id in zone_surfaces_ids:
# zone_surfaces.append(self.surface(surface_id))
#self._thermal_zones.append(ThermalZone(zone_surfaces))
#for t_zones in self._thermal_zones:
# t_zones.bounded = [ThermalBoundary(s, [t_zones]) for s in t_zones.surfaces]
from city_model_structure.attributes.polygon import Polygon
from city_model_structure.attributes.plane import Plane
from city_model_structure.attributes.point import Point
import numpy as np
coordinates = [np.array([1, 0, 0]), np.array([0, 0, 0]), np.array([0, 0, 1]), np.array([1, 0, 1])]
polygon = Polygon(coordinates)
origin = Point([0, 0, 0.5])
normal = np.array([0, 0, 1])
plane = Plane(normal=normal, origin=origin)
intersection, polygon_1, polygon_2 = polygon.divide(plane)
print('final polygon')
print(polygon_1.coordinates)
print(polygon_2.coordinates)