Exemplo n.º 1
0
def zonearea(dct, zone):
    """return the area of the zone
    this is the sum of all areas of faces that have 'surfacedirection'=180"""
    facelist = dct.keys()
    zonefacelist = [face for face in facelist if dct[face]['layer'] == zone]
    zonefloorlist = [face for face in zonefacelist \
                        if dct[face]['surfacedirection'] == 180]
    areas = [geometry.polygonarea3d(dct[floor]['points']) for floor in zonefloorlist]
    return sum(areas)
def test_polygonarea3d():
    """py.test or polygonarea3d()"""
    poly = [[97.952770165533494, -89.688089019337596, 1.23613716318408e-14],
     [-42.113949041963799, -48.668412230783197, 4.3225283531169101e-15],
     [-176.015056172523, 95.487947355641097, 9.98244187111785e-15],
     [-59.700839733667401, 203.52759542159399, 9.98244187111785e-15],
     [193.10639752719001, 28.032400933162201, 2.21573588081702e-14],
     [175.70277016553399, -89.688089019337596, 1.23613716318408e-14]]
    area = 60724.6427925073
    result = geometry.polygonarea3d(poly)
    assert almostequals(result, area)