Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pilar 2022-02-17 12:37:33 -05:00
commit 659df7079c

View File

@ -67,6 +67,7 @@ class Rhino:
for obj in self._model.Objects:
name = obj.Attributes.Id
surfaces = []
try:
for face in obj.Geometry.Faces:
if face is None:
break
@ -80,6 +81,8 @@ class Rhino:
_points = _points + f'{_mesh.Vertices[index].X} {_mesh.Vertices[index].Y} {_mesh.Vertices[index].Z} '
polygon_points = Rhino._solid_points(_points.strip())
surfaces.append(LibsSurface(Polygon(polygon_points), Polygon(polygon_points)))
except AttributeError:
continue
rhino_objects.append(Building(name, 3, surfaces, 'unknown', 'unknown', (self._min_x, self._min_y, self._min_z), []))
lower_corner = (self._min_x, self._min_y, self._min_z)
upper_corner = (self._max_x, self._max_y, self._max_z)
@ -89,27 +92,27 @@ class Rhino:
# is not a building but a window!
for surface in rhino_object.surfaces:
# add to windows the "hole" with the normal inverted
print('window')
windows.append(Polygon(surface.perimeter_polygon.inverse))
else:
buildings.append(rhino_object)
print(f'windows: {len(windows)}')
# todo: this method will be pretty inefficient
for hole in windows:
corner = hole.coordinates[0]
for building in buildings:
for surface in building.surfaces:
plane = surface.perimeter_polygon.plane
if plane.distance(corner) <= EPSILON:
# todo: this is a hack for dompark project it should not be done this way
# todo: this is a hack for dompark project it should not be done this way windows should be correctly modeled
# if the distance between the wall plane and the window is less than 2m
# and the window Z coordinate it's between the wall Z, it's a window of that wall
if plane.distance(corner) <= 2:
# check if the window is in the right high.
if surface.upper_corner[2] >= corner[2] >= surface.lower_corner[2]:
if surface.holes_polygons is None:
surface.holes_polygons = []
surface.holes_polygons.append(hole)
for building in buildings:
city.add_city_object(building)
return city