solved errors with geometry.py
This commit is contained in:
parent
2385827d0a
commit
5720eca3c3
|
@ -15,7 +15,7 @@ from shapely.geometry import MultiPolygon
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import matplotlib.patches as patches
|
import matplotlib.patches as patches
|
||||||
from helpers.geometry import Geometry
|
from helpers.geometry_helper import GeometryHelper
|
||||||
from city_model_structure.usage_zone import UsageZone
|
from city_model_structure.usage_zone import UsageZone
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class CityObject:
|
||||||
self._year_of_construction = year_of_construction
|
self._year_of_construction = year_of_construction
|
||||||
self._function = function
|
self._function = function
|
||||||
self._lower_corner = lower_corner
|
self._lower_corner = lower_corner
|
||||||
self._geometry = Geometry()
|
self._geometry = GeometryHelper()
|
||||||
self._average_storey_height = None
|
self._average_storey_height = None
|
||||||
self._storeys_above_ground = None
|
self._storeys_above_ground = None
|
||||||
self._foot_print = None
|
self._foot_print = None
|
||||||
|
|
|
@ -5,7 +5,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import stl
|
import stl
|
||||||
from helpers.geometry import Geometry
|
from helpers.geometry_helper import GeometryHelper
|
||||||
|
|
||||||
|
|
||||||
class Polyhedron:
|
class Polyhedron:
|
||||||
|
@ -20,7 +20,7 @@ class Polyhedron:
|
||||||
self._faces = None
|
self._faces = None
|
||||||
self._vertices = None
|
self._vertices = None
|
||||||
self._mesh = None
|
self._mesh = None
|
||||||
self._geometry = Geometry()
|
self._geometry = GeometryHelper()
|
||||||
|
|
||||||
def _position_of(self, point):
|
def _position_of(self, point):
|
||||||
vertices = self.vertices
|
vertices = self.vertices
|
||||||
|
|
|
@ -7,7 +7,7 @@ from __future__ import annotations
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyny3d.geoms as pn
|
import pyny3d.geoms as pn
|
||||||
from helpers.geometry import Geometry
|
from helpers.geometry_helper import GeometryHelper
|
||||||
|
|
||||||
|
|
||||||
class Surface:
|
class Surface:
|
||||||
|
@ -21,7 +21,7 @@ class Surface:
|
||||||
self._swr = swr
|
self._swr = swr
|
||||||
self._remove_last = remove_last
|
self._remove_last = remove_last
|
||||||
self._is_projected = is_projected
|
self._is_projected = is_projected
|
||||||
self._geometry = Geometry()
|
self._geometry = GeometryHelper()
|
||||||
self._polygon = None
|
self._polygon = None
|
||||||
self._ground_polygon = None
|
self._ground_polygon = None
|
||||||
self._area = None
|
self._area = None
|
||||||
|
@ -89,7 +89,7 @@ class Surface:
|
||||||
"""
|
"""
|
||||||
if self._points is None:
|
if self._points is None:
|
||||||
self._points = np.fromstring(self._coordinates, dtype=float, sep=' ')
|
self._points = np.fromstring(self._coordinates, dtype=float, sep=' ')
|
||||||
self._points = Geometry.to_points_matrix(self._points, self._remove_last)
|
self._points = GeometryHelper.to_points_matrix(self._points, self._remove_last)
|
||||||
return self._points
|
return self._points
|
||||||
|
|
||||||
def _min_coord(self, axis):
|
def _min_coord(self, axis):
|
||||||
|
@ -153,7 +153,7 @@ class Surface:
|
||||||
coordinates = coordinates + ' '
|
coordinates = coordinates + ' '
|
||||||
coordinates = coordinates + str(x) + ' ' + str(y) + ' ' + str(z)
|
coordinates = coordinates + str(x) + ' ' + str(y) + ' ' + str(z)
|
||||||
self._ground_points = np.fromstring(coordinates, dtype=float, sep=' ')
|
self._ground_points = np.fromstring(coordinates, dtype=float, sep=' ')
|
||||||
self._ground_points = Geometry.to_points_matrix(self._ground_points, False)
|
self._ground_points = GeometryHelper.to_points_matrix(self._ground_points, False)
|
||||||
return self._ground_points
|
return self._ground_points
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -7,7 +7,7 @@ from typing import List
|
||||||
from city_model_structure.thermal_opening import ThermalOpening
|
from city_model_structure.thermal_opening import ThermalOpening
|
||||||
from city_model_structure.thermal_zone import ThermalZone
|
from city_model_structure.thermal_zone import ThermalZone
|
||||||
from city_model_structure.layer import Layer
|
from city_model_structure.layer import Layer
|
||||||
from helpers.configuration import Configuration
|
from helpers.configuration_helper import ConfigurationHelper
|
||||||
|
|
||||||
|
|
||||||
class ThermalBoundary:
|
class ThermalBoundary:
|
||||||
|
@ -20,7 +20,7 @@ class ThermalBoundary:
|
||||||
# ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary, review for LOD3 and LOD4
|
# ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary, review for LOD3 and LOD4
|
||||||
self._thermal_openings = [ThermalOpening()]
|
self._thermal_openings = [ThermalOpening()]
|
||||||
self._layers = None
|
self._layers = None
|
||||||
self._outside_solar_absorptance = Configuration().outside_solar_absorptance
|
self._outside_solar_absorptance = ConfigurationHelper().outside_solar_absorptance
|
||||||
self._outside_thermal_absorptance = None
|
self._outside_thermal_absorptance = None
|
||||||
self._outside_visible_absorptance = None
|
self._outside_visible_absorptance = None
|
||||||
self._window_ratio = None
|
self._window_ratio = None
|
||||||
|
@ -208,8 +208,8 @@ class ThermalBoundary:
|
||||||
:return: float
|
:return: float
|
||||||
"""
|
"""
|
||||||
if self._u_value is None:
|
if self._u_value is None:
|
||||||
h_i = Configuration().h_i
|
h_i = ConfigurationHelper().h_i
|
||||||
h_e = Configuration().h_e
|
h_e = ConfigurationHelper().h_e
|
||||||
r_value = 1.0/h_i + 1.0/h_e
|
r_value = 1.0/h_i + 1.0/h_e
|
||||||
try:
|
try:
|
||||||
for layer in self.layers:
|
for layer in self.layers:
|
||||||
|
|
|
@ -3,7 +3,7 @@ ThermalOpening module
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
"""
|
"""
|
||||||
from helpers.configuration import Configuration
|
from helpers.configuration_helper import ConfigurationHelper
|
||||||
|
|
||||||
|
|
||||||
class ThermalOpening:
|
class ThermalOpening:
|
||||||
|
@ -13,7 +13,7 @@ class ThermalOpening:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._openable_ratio = None
|
self._openable_ratio = None
|
||||||
self._conductivity = None
|
self._conductivity = None
|
||||||
self._frame_ratio = Configuration().frame_ratio
|
self._frame_ratio = ConfigurationHelper().frame_ratio
|
||||||
self._g_value = None
|
self._g_value = None
|
||||||
self._thickness = None
|
self._thickness = None
|
||||||
self._front_side_solar_transmittance_at_normal_incidence = None
|
self._front_side_solar_transmittance_at_normal_incidence = None
|
||||||
|
@ -56,8 +56,8 @@ class ThermalOpening:
|
||||||
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
|
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
|
||||||
self._conductivity = value
|
self._conductivity = value
|
||||||
if self._overall_u_value is None and self.thickness is not None:
|
if self._overall_u_value is None and self.thickness is not None:
|
||||||
h_i = Configuration().h_i
|
h_i = ConfigurationHelper().h_i
|
||||||
h_e = Configuration().h_e
|
h_e = ConfigurationHelper().h_e
|
||||||
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
|
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
|
||||||
self._overall_u_value = 1 / r_value
|
self._overall_u_value = 1 / r_value
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ class ThermalOpening:
|
||||||
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
|
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
|
||||||
self._thickness = value
|
self._thickness = value
|
||||||
if self._overall_u_value is None and self.conductivity is not None:
|
if self._overall_u_value is None and self.conductivity is not None:
|
||||||
h_i = Configuration().h_i
|
h_i = ConfigurationHelper().h_i
|
||||||
h_e = Configuration().h_e
|
h_e = ConfigurationHelper().h_e
|
||||||
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
|
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
|
||||||
self._overall_u_value = 1 / r_value
|
self._overall_u_value = 1 / r_value
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
|
||||||
from typing import List, TypeVar
|
from typing import List, TypeVar
|
||||||
from city_model_structure.usage_zone import UsageZone
|
from city_model_structure.usage_zone import UsageZone
|
||||||
from city_model_structure.surface import Surface
|
from city_model_structure.surface import Surface
|
||||||
from helpers.configuration import Configuration
|
from helpers.configuration_helper import ConfigurationHelper
|
||||||
|
|
||||||
ThermalBoundary = TypeVar('ThermalBoundary')
|
ThermalBoundary = TypeVar('ThermalBoundary')
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ class ThermalZone:
|
||||||
self._surfaces = surfaces
|
self._surfaces = surfaces
|
||||||
self._floor_area = None
|
self._floor_area = None
|
||||||
self._bounded = None
|
self._bounded = None
|
||||||
self._heated = Configuration().heated
|
self._heated = ConfigurationHelper().heated
|
||||||
self._cooled = Configuration().cooled
|
self._cooled = ConfigurationHelper().cooled
|
||||||
self._additional_thermal_bridge_u_value = Configuration().additional_thermal_bridge_u_value
|
self._additional_thermal_bridge_u_value = ConfigurationHelper().additional_thermal_bridge_u_value
|
||||||
self._effective_thermal_capacity = None
|
self._effective_thermal_capacity = None
|
||||||
self._indirectly_heated_area_ratio = Configuration().indirectly_heated_area_ratio
|
self._indirectly_heated_area_ratio = ConfigurationHelper().indirectly_heated_area_ratio
|
||||||
self._infiltration_rate_system_on = Configuration().infiltration_rate_system_on
|
self._infiltration_rate_system_on = ConfigurationHelper().infiltration_rate_system_on
|
||||||
self._infiltration_rate_system_off = None
|
self._infiltration_rate_system_off = None
|
||||||
self._usage_zones = None
|
self._usage_zones = None
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import numpy as np
|
||||||
from city_model_structure.city import City
|
from city_model_structure.city import City
|
||||||
from city_model_structure.city_object import CityObject
|
from city_model_structure.city_object import CityObject
|
||||||
from city_model_structure.surface import Surface
|
from city_model_structure.surface import Surface
|
||||||
from helpers.geometry import Geometry
|
from helpers.geometry_helper import GeometryHelper
|
||||||
|
|
||||||
|
|
||||||
class CityGml:
|
class CityGml:
|
||||||
|
@ -32,7 +32,7 @@ class CityGml:
|
||||||
'http://www.opengis.net/citygml/2.0': None
|
'http://www.opengis.net/citygml/2.0': None
|
||||||
}, force_list=('cityObjectMember', 'curveMember'))
|
}, force_list=('cityObjectMember', 'curveMember'))
|
||||||
self._cityObjects = None
|
self._cityObjects = None
|
||||||
self._geometry = Geometry()
|
self._geometry = GeometryHelper()
|
||||||
envelope = self._gml['CityModel']['boundedBy']['Envelope']
|
envelope = self._gml['CityModel']['boundedBy']['Envelope']
|
||||||
if '#text' in envelope['lowerCorner']:
|
if '#text' in envelope['lowerCorner']:
|
||||||
self._lower_corner = np.fromstring(envelope['lowerCorner']['#text'], dtype=float, sep=' ')
|
self._lower_corner = np.fromstring(envelope['lowerCorner']['#text'], dtype=float, sep=' ')
|
||||||
|
|
|
@ -7,7 +7,7 @@ import configparser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class Configuration:
|
class ConfigurationHelper:
|
||||||
"""
|
"""
|
||||||
Configuration class
|
Configuration class
|
||||||
"""
|
"""
|
|
@ -10,7 +10,7 @@ from trimesh import intersections
|
||||||
import open3d as o3d
|
import open3d as o3d
|
||||||
|
|
||||||
|
|
||||||
class Geometry:
|
class GeometryHelper:
|
||||||
"""
|
"""
|
||||||
Geometry helper class
|
Geometry helper class
|
||||||
"""
|
"""
|
||||||
|
@ -155,11 +155,11 @@ class Geometry:
|
||||||
mesh_final.append(mesh)
|
mesh_final.append(mesh)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
points = Geometry._segment_list_to_point_cloud(mesh_1_segments)
|
points = GeometryHelper._segment_list_to_point_cloud(mesh_1_segments)
|
||||||
points_normals = [[None] * 3] * len(points)
|
points_normals = [[None] * 3] * len(points)
|
||||||
for j in range(0, len(points_normals)):
|
for j in range(0, len(points_normals)):
|
||||||
points_normals[j] = normal_opp[i]
|
points_normals[j] = normal_opp[i]
|
||||||
mesh_2 = Geometry._point_cloud_to_mesh(points, points_normals)
|
mesh_2 = GeometryHelper._point_cloud_to_mesh(points, points_normals)
|
||||||
mesh_final.append(Geometry._merge_meshes(mesh_1, mesh_2))
|
mesh_final.append(GeometryHelper._merge_meshes(mesh_1, mesh_2))
|
||||||
|
|
||||||
return mesh_final
|
return mesh_final
|
Loading…
Reference in New Issue
Block a user