from tess import Container from vorodat import limits, vorodata c = Container(vorodata, limits=limits, periodic=False) with open("forrest.inc",'a') as file: file.write('#declare Trunkbase = array[100]{\n') for i in c[0:100]: x,y,z=i.pos file.write(f"<{x},{y},{z}>\n") file.write("\n};\n") file.write('#declare FoliagePoint = array[100]{\n') for i in c[100:200]: x,y,z=i.pos file.write(f"<{x},{y},{z}>\n") file.write("\n};\n") file.write('#declare Neighbors = array[100]{\n') for i in c[100:200]: noabers = [e for e in i.neighbors() if (e>=0)] length = len(noabers) file.write(f"//{i}\n") file.write(f"array[{length}]") file.write("{\n") for j in noabers: x,y,z=c[j].pos file.write(f"<{x},{y},{z}>\n") file.write("\n},\n") file.write("\n};\n")