new way of calculating surface finished

This commit is contained in:
pilar 2020-12-01 16:28:24 -05:00
parent 024e47fe0c
commit 7891e5450e

View File

@ -270,17 +270,16 @@ class Surface:
else:
for point in self.points:
points_2d.append([point[0], point[1]])
points_2d.append([point[0], point[1], 0])
polygon_2d = pn.Polygon(np.array(points_2d))
print('2D:')
print(polygon_2d.points)
print('AQUÍ ACABA EL PASO A 2D')
# 2. calculate area:
area = 0
for point in polygon_2d.points:
next_point = [0] # todo: cómo se consigue esto??
for i in range(0, len(polygon_2d.points)-1):
point = polygon_2d.points[i]
next_point = polygon_2d.points[i+1]
area += (next_point[1] + point[1]) / 2 * (next_point[0] - point[0])
self._area = area
return self._area