Code review and small corrections over the new interfaces dor physics and usage factories

This commit is contained in:
Guille 2021-01-08 09:16:01 -05:00
parent e21f2bcb0a
commit feab805be2
2 changed files with 9 additions and 5 deletions

View File

@ -30,7 +30,8 @@ class Polyhedron:
self._min_z = None
self._min_y = None
self._min_x = None
self._geometry = GeometryHelper(delta=0.5, area_delta=0.001)
self._geometry = GeometryHelper(delta=5.0, area_delta=0.01)
print(f'[{self._geometry._area_delta} {self._geometry._delta}]')
def _position_of(self, point, face):
vertices = self.vertices
@ -53,7 +54,7 @@ class Polyhedron:
found = False
for vertex_2 in self._vertices:
found = False
if self._geometry.almost_equal(vertex_1, vertex_2, True):
if self._geometry.almost_equal(vertex_1, vertex_2):
found = True
break
if not found:
@ -139,8 +140,6 @@ class Polyhedron:
else:
point_index = point_index + 3
if point_index >= len(points_list):
# print('wroooong', complementary_surface.type)
# print(complementary_surface.points)
return triangles
if len(points_list) == 9:
# the rest point's are already a triangle

View File

@ -79,11 +79,16 @@ class TestGeometryFactory(TestCase):
city = City.load(self._kelowna_pickle_file)
helper = GeometryHelper(delta=0.0, area_delta=0.5)
errors = 0
ok = 0
for building in city.buildings:
building._polyhedron._geometry = helper
if str(building.volume) == 'inf':
building.obj_export(self._output_path)
building.stl_export(self._output_path)
errors += 1
elif ok == 0:
building.stl_export(self._output_path)
print(f'ok {building.name} {building.volume}')
ok = 1
print(f'{errors} buildings aren\'t closed volumes')
def test_citygml_buildings(self):