solved one bug
This commit is contained in:
parent
7891e5450e
commit
f0d6176bab
|
@ -71,6 +71,7 @@ class Polyhedron:
|
||||||
points_list = surface.points_list
|
points_list = surface.points_list
|
||||||
point_index = 0
|
point_index = 0
|
||||||
area = surface.area
|
area = surface.area
|
||||||
|
print('AREA:', area)
|
||||||
while len(triangles) < triangles_count:
|
while len(triangles) < triangles_count:
|
||||||
# select a triangle starting at point index
|
# select a triangle starting at point index
|
||||||
triangle_points = ' '.join(str(e) for e in [*points_list[point_index:point_index + 9]])
|
triangle_points = ' '.join(str(e) for e in [*points_list[point_index:point_index + 9]])
|
||||||
|
@ -78,6 +79,8 @@ class Polyhedron:
|
||||||
rest_points = ' '.join(str(e) for e in [*points_list[0:point_index+3], *points_list[point_index+6:]])
|
rest_points = ' '.join(str(e) for e in [*points_list[0:point_index+3], *points_list[point_index+6:]])
|
||||||
triangular_surface = Surface(triangle_points, remove_last=False)
|
triangular_surface = Surface(triangle_points, remove_last=False)
|
||||||
rest_surface = Surface(rest_points, remove_last=False)
|
rest_surface = Surface(rest_points, remove_last=False)
|
||||||
|
print('triangular_surface:', triangular_surface.points)
|
||||||
|
print('triangular_surface_AREA:', triangular_surface.area)
|
||||||
if self._geometry.almost_same_area(area, (triangular_surface.area + rest_surface.area)):
|
if self._geometry.almost_same_area(area, (triangular_surface.area + rest_surface.area)):
|
||||||
area = rest_surface.area
|
area = rest_surface.area
|
||||||
triangles.append(triangular_surface)
|
triangles.append(triangular_surface)
|
||||||
|
|
|
@ -222,7 +222,9 @@ class Surface:
|
||||||
print('NEW METHOD TO CALCULATE AREA')
|
print('NEW METHOD TO CALCULATE AREA')
|
||||||
print('original:')
|
print('original:')
|
||||||
print(self.points)
|
print(self.points)
|
||||||
|
if len(self.points) < 3:
|
||||||
|
area = 0
|
||||||
|
else:
|
||||||
# 1. 3D -> 2D
|
# 1. 3D -> 2D
|
||||||
z_vector = [0, 0, 1]
|
z_vector = [0, 0, 1]
|
||||||
normal_vector = self.normal
|
normal_vector = self.normal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user